Loading section...

Meeting Rooms: How Many Rooms Do You Need?

Concepts: pyMeetingRooms, pyMinHeapScheduling, pySweepTwoPointer

Meeting rooms II is the most common interval problem in on-site data engineering interviews at big tech. The question: given a list of meeting intervals, find the minimum number of meeting rooms required to hold all meetings simultaneously. The naive read is 'find the maximum number of overlapping intervals at any point in time.' There are two clean approaches. The heap approach is more intuitive; the event sweep approach is more generalizable. Know both. Approach 1: Min-Heap on End Times Sort meetings by start time. Use a min-heap that tracks the end times of currently active meetings. For each new meeting: if the heap's minimum end time is <= the new meeting's start time, the earliest-ending room is free — reuse it by popping the old end time. Otherwise, open a new room. Push the new mee