Cloze

Merge Intervals

Sort, then merge · O(n log n) time, O(n) space · LeetCode ↗

intervals are pairs of start and end, in any order. Merge every overlapping pair, and return what is left, sorted by start. Intervals that only touch at an end overlap.