This question evaluates understanding of interval manipulation, array processing, and algorithmic efficiency by requiring reasoning about overlapping ranges and proper handling of edge cases.
Given an array of closed intervals intervals, where each interval is [start, end] and start <= end, merge all overlapping intervals and return an array of the merged, non-overlapping intervals sorted by start time.
Two intervals [a, b] and [c, d] overlap if c <= b (assuming a <= c).
intervals
: list of
n
intervals
Input: [[1,3],[2,6],[8,10],[15,18]]
Output: [[1,6],[8,10],[15,18]]
1 ≤ n ≤ 10^5