Company: IBM_19nov
Difficulty: medium
Merge Intervals Problem Description Given a collection of time intervals represented as pairs [start, end], merge any overlapping intervals. The intervals are already sorted by their start times. Complete the function getMergedIntervals in the editor with the following parameter(s): - intervals[2D]: the time intervals Returns: - intervals[2D]: the merged intervals in sorted order. Examples Example 1: Input: intervals = [[1,3], [2,7], [6,10], [15,18]] Output: [[1,10], [15,18]] Explanation: The interval [1,3] merges with [2,7] while [2,7] merges with [6,10]. There are no more overlapping intervals. The answer is [[1,10], [15,18]]. Example 2: Input: intervals = [[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 3: Input: intervals = [[4,8], [2,6], [5,7]] Output: [[2,8]] Explanation