|
1 | 1 | # https://leetcode.com/problems/insert-interval/
|
2 | 2 | #
|
3 |
| -# Given a set of non-overlapping intervals, insert a new interval into |
4 |
| -# the intervals (merge if necessary). |
| 3 | +# Given a set of non-overlapping intervals, insert a new interval into the |
| 4 | +# intervals (merge if necessary). |
5 | 5 | #
|
6 |
| -# You may assume that the intervals were initially sorted according |
7 |
| -# to their start times. |
| 6 | +# You may assume that the intervals were initially sorted according to their |
| 7 | +# start times. |
8 | 8 | #
|
9 | 9 | # Example 1:
|
10 | 10 | #
|
11 |
| -# Given intervals [1,3],[6,9], insert and merge [2,5] in as |
12 |
| -# [1,5],[6,9]. |
| 11 | +# Given intervals [1, 3], [6, 9], insert and merge [2, 5] in as [1, 5], |
| 12 | +# [6, 9]. |
13 | 13 | #
|
14 | 14 | # Example 2:
|
15 | 15 | #
|
16 |
| -# Given [1,2],[3,5],[6,7],[8,10],[12,16], insert and merge [4,9] |
17 |
| -# in as [1,2],[3,10],[12,16]. This is because the new interval |
18 |
| -# [4,9] overlaps with [3,5],[6,7],[8,10]. |
| 16 | +# Given [1, 2], [3, 5], [6, 7], [8, 10], [12, 16], insert and merge [4, 9] |
| 17 | +# in as [1, 2], [3, 10], [12, 16]. This is because the new interval [4, 9] |
| 18 | +# overlaps with [3, 5], [6, 7], [8, 10]. |
19 | 19 |
|
20 | 20 |
|
21 | 21 | # Definition for an interval.
|
|
0 commit comments