Company: jubliant_19sep
Difficulty: medium
Merge Intervals Problem Description Implement a function to merge overlapping time intervals. Given a collection of time intervals represented as pairs [start, end] , merge any overlapping intervals and return them sorted by their start times. Complete the function getMergedIntervals in the editor with the following parameter(s): int intervals[n][2] : the time intervals Returns: int[n][2] : the merged intervals in sorted order Examples Example 1: Input: 5 2 6 9 2 3 9 11 1 5 14 18 Output: 1 5 6 11 14 18 Explanation: The intervals [2, 3] and [1, 5] merge into [1, 5] , and the intervals [6, 9] and [9, 11] merge into [6, 11] . The merged intervals in sorted order are [1, 5] , [6, 11] , [14, 18] . Example 2: Input: 3 2 4 8 2 6 5 7 Output: 2 8 Explanation: All three intervals overlap and merge into [2, 8] . Constraints 1 <= n <= 10^5 1 <= intervals[i][0] <= intervals[i][1] <= 10^9