Hints — p49 Meeting Rooms II
Hint 1. ASK: half-open or closed? Does [0, 10] and [10, 20] need 1 room or 2? (LC 253: half-open → 1 room.)
Hint 2. Rephrase: “min rooms” = max number of meetings overlapping at any single moment. This unlocks sweep-line thinking.
Hint 3. Heap approach. Sort by start. Walk through; maintain a min-heap of END times of rooms currently in use. Before each meeting, if heap[0] <= start, that room freed up — pop. Always push current end. Max heap size = answer.
Hint 4. Two-pointer approach. Sort starts and ends INDEPENDENTLY (not as pairs). Walk a pointer s and e; if starts[s] < ends[e] need new room (active++); else a room freed (e++, active–). Track max active.
Hint 5. Both approaches are O(n log n). The two-pointer is slightly faster in practice (no heap overhead); the heap generalizes more easily (e.g., if you need to ID which room). Produce BOTH in a senior interview.
If still stuck: see solution.py.