In a Meta scheduling pipeline, you are given a list of time ranges representing busy windows for a service or model job. Merge all overlapping time ranges and return the minimal set of non-overlapping ranges covering the same time.
Implement a function that takes intervals, a list of intervals where each interval is a list [start, end] with start <= end, and returns a new list of merged intervals sorted by start time.
Two intervals overlap if the next interval's start is less than or equal to the current merged interval's end. In that case, they should be combined into [min_start, max_end].
Example 1
Input: intervals = [[1,3],[2,6],[8,10],[15,18]]
Output: [[1,6],[8,10],[15,18]]
Explanation: [1,3] and [2,6] overlap, so they merge into [1,6].
Example 2
Input: intervals = [[1,4],[4,5]]
Output: [[1,5]]
Explanation: The intervals touch at 4, so they are considered overlapping and should be merged.
0 <= len(intervals) <= 10^5intervals[i].length == 20 <= start <= end <= 10^9