Merge Overlapping Intervals
Combine ranges that touch or overlap.
The Merge Goal
Given many intervals, you want to merge the ones that touch or overlap into the fewest possible non-overlapping ranges. 🧩
When Two Intervals Overlap
Two intervals overlap when one starts before the other ends. After sorting by start, that means the next start is at or below the current end.
All lessons in this course
- Sort Intervals by Start
- Merge Overlapping Intervals
- Line Sweep for Max Overlap
- Minimum Removals for No Overlap