Intuition
- The input is already sorted, so what we do is to find the range of the insert.
- Iterate the input, if current.end < new.start, just add it to the result.
- Record the start which is the smaller one between new and current.
- Continue iterate, when the current.start > end, we find the end edge of the insert position. Add a interval from start to end, and add the rest intervals.
solution
|
|