Given a list of time intervals intervals, where each interval is represented as [start, end], merge all overlapping intervals and return a new list of non-overlapping intervals that covers the same ranges. Two intervals overlap if the next interval starts before or at the end of the current merged interval.
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 are merged 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.
1 <= len(intervals) <= 10^4intervals[i].length == 20 <= start <= end <= 10^9