Pattern Recognition Drill
Medium Intervals
The Problem
Given meeting time intervals, find the minimum number of 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 <= current start, reuse room. Else add room. O(n log n).
Separate starts and ends into sorted arrays. Sweep with two pointers counting active meetings. O(n log n).
Common Trap
Don't try to simulate rooms directly. The heap tracks the earliest-ending meeting for reuse.