Intervals
Interval problems become simple after you normalize the meaning of overlap and sort by the right key. Most mistakes come from boundary handling: inclusive vs exclusive endpoints, current merged end, or event ordering at ties.
Mental Model
- Sort by start when merging or inserting ranges.
- Sort by end when choosing the maximum compatible set.
- Sweep events when many queries or concurrent counts matter.
- Heap by end time when tracking active intervals.
Diagram
Loading diagram…
Problem List
Start with 252. Meeting Rooms, 253. Meeting Rooms II, 057. Insert Interval, 986. Interval List Intersections, and 1851. Minimum Interval to Include Each Query.
Mark this page when you finish learning it.
Last updated on
Spotted something unclear or wrong on this page?