PATTERN 14 · 5 PROBLEMS
Intervals & sweep line
Sort boundaries so overlap and resource changes become one directional scan.
Start the first lesson ↗MASTER KEYAfter sorting, only the active frontier can conflict.
0OF 5
RECALLED
RECALLED
Intervals before, overlapping, and after the new interval form three ordered phases.
Not started
↗02Insert Interval
Intervals before, overlapping, and after the new interval form three ordered phases.
Not started
↗03Merge Intervals
After sorting by start, only the last merged interval can overlap the next.
Not started
↗04Non-overlapping Intervals
Keeping the interval that ends earliest leaves the most room for future intervals.
Not started
↗05Meeting Rooms
After sorting by start, only adjacent meetings can reveal an overlap.
Not started
↗Meeting Rooms II
A room frees when the earliest current end is no later than the next start.