Sort Intervals by Start
Order events before processing.
What an Interval Is
An interval is just a pair of numbers, a start and an end, like [2, 5]. Most interval problems are a list of these pairs. 📏
Order Brings Sanity
Raw intervals arrive in any order, which makes them hard to reason about. Sorting them first turns chaos into a clean left-to-right sweep.
All lessons in this course
- Sort Intervals by Start
- Merge Overlapping Intervals
- Line Sweep for Max Overlap
- Minimum Removals for No Overlap