Merge Overlapping Intervals

medium
Unit 1 · Hash Map0/3 to milestone

Given a list of [start, end] intervals, merge every set of overlapping intervals and return the result sorted by start.

Intervals that only touch (like [1, 3] and [3, 5]) count as overlapping. The input may be in any order.

Example

merge([[8, 10], [1, 3], [2, 6], [15, 18]])
# [[1, 6], [8, 10], [15, 18]]
#sorting#intervals3 visible + 2 hidden tests
solution.py · Python 3.13
Loading editor…
Run your code to see results. ⌘↵ to run · ⌘⇧↵ to submit
Merge Overlapping Intervals · TechGradify