Merge Overlapping Intervals
Medium
arrays
Google
Meta
Microsoft
Given a list of intervals [[start, end], ...], merge all overlapping intervals and return the result sorted by start time.
Example
merge_intervals([[1, 3], [2, 6], [8, 10], [15, 18]])
# => [[1, 6], [8, 10], [15, 18]]
Test Cases
Python Editor
Output
Click "Run" to see results...