Pattern Recognition Drill
Medium Heaps
The Problem
Given meeting intervals [start, end], find minimum conference rooms required.
What approach would you use?
Think about it before scrolling down.
Sort by start. Min-heap of end times. If earliest end <= new start, reuse room (pop). Else add room. O(n log n).
Separate start and end arrays, sweep-line counting overlaps. Same O(n log n), less intuitive.
Common Trap
The heap tracks the earliest-ending meeting. If it ends before the new one starts, the room is freed.