Medium
,Array
You are given an array of non-overlapping intervals intervals
where intervals[i]
= [, ] represent the start and the end of the ith interval and intervals
is sorted in ascending order by . You are also given an interval newInterval
= [start, end]
that represents the start and end of another interval.
Insert newInterval
into intervals
such that intervals is still sorted in ascending order by and intervals
still does not have any overlapping intervals (merge overlapping intervals if necessary).
Return intervals
after the insertion.
Example 1:
Example 2:
Constraints:
intervals[i].length
== 2intervals
is sorted by in ascending order.newInterval.length
== 2start
<= end
<= 105Marsgoat Jan 16, 2023
看到有人會把數字換成文字,不知道大家覺得2跟3哪個好,這樣可讀性真的有比較高嗎?
Marsgoat Jan 17, 2023
XD Jan 16, 2023
Time:
Extra Space:
Ron Chen Jan 17, 2023