Problem Brief
Merge Intervals
INTERNOA
Given a collection of time intervals, [start, end], merge and return the overlapping intervals sorted in ascending order of their start times.
Function Description
Complete the function getMergedIntervals in the editor below.
getMergedIntervals has the following parameters:
int intervals[[n][2]]: the time intervals
Returns
int[][2]: the merged intervals in sorted order
1Example 1
Input
intervals = [[7, 7], [2, 3], [6, 11], [1, 23]]
Output
[[1, 3], [6, 11]]
Explanation
an educated guess -
The interval [1, 2] merges with [2, 3] while [7, 7] merges with [6, 11]. There are no more overlapping intervals. The answer is [[1, 3], [6, 11]].
Constraints
Limits and guarantees your solution can rely on.