← 返回 oracle 的题目列表Insert Intervals with Set
类型:online_judge
oracle
Given a set of non-overlapping intervals intervals and a new interval newInterval, insert newInterval into intervals such that intervals remains non-overlapping and sorted, and output the merged interval result. Assume that set automatically sorts the elements. Provide the algorithm implementation and analyze its time complexity.
Example
Input
[[1,3],[6,9]]
[2,5]