The Question
CodingMerge Overlapping Intervals
Given an array of intervals where intervals[i] = [start_i, end_i], representing the time ranges of medical procedures for a patient, merge all overlapping intervals. Return an array of the non-overlapping intervals that cover all the intervals in the input. Two intervals [1, 3] and [3, 4] are considered overlapping because they touch at the boundary.
Constraints:
- 1 <= intervals.length <= 10^4
- intervals[i].length == 2
- 0 <= start_i <= end_i <= 10^4
Python
Sorting
Greedy