Intervals
Sort and merge overlapping or adjacent intervals to solve scheduling, coverage, and overlap problems.
- • Merge overlapping ranges
- • Find conflicts/overlaps
- • Insert into sorted intervals
- • Meeting room scheduling
- • Point data (not ranges)
- • No ordering relationship
- • Not sorting by start time first
- • Edge cases: touching but not overlapping
- • Forgetting to handle the last interval
Key Invariant
Sort by start time, then greedily merge/compare adjacent intervals