Problem
Given a collection of intervals, merge all overlapping intervals.
Examples
1 | Input: [[1,3],[2,6],[8,10],[15,18]] |
1 | Input: [[1,4],[4,5]] |
Boundary Conditions
Solution
Method: Sort
Time Complexity: O(n log n)
Space Complexity: O(n)
1 | # Definition for an interval. |
1 | # Definition for an interval. |