Watch a calendar day booked into the fewest rooms: sort meetings by start, keep a min-heap of when each room frees up, and reuse the earliest room the moment it is free. O(N log N) time, O(N) space.
About this algorithm
Meeting Rooms II asks for the fewest rooms that can hold a list of meetings, given each one's start and end time. Sort the meetings by start, and keep a min heap of the end times of the rooms in use. Its root is the room that frees up first, so one look at the root decides whether a meeting can reuse a room or needs a new one.
Use this pattern for any "how many at the same time" question over intervals: rooms for meetings, platforms for trains, servers for jobs. The heap version also tells you which room each meeting gets, which a bare count cannot. If you only need the number, a sweep works too: sort all starts and all ends separately and walk both lists with two pointers, also in O(N log N). Meeting Rooms I, which only asks whether one person can attend everything, needs no heap: sort by start and check each meeting begins after the previous one ends. The min heap page shows the heap operations on their own; this page puts them to work.
Handle the meetings in the order they begin, so each one only has to fit around meetings that started earlier.
The heap holds one end time per room in use. Its root is the room that becomes free soonest, the only one worth checking.
If that earliest end is at or before the new meeting's start, the room is free: pop it and give it to the new meeting. Otherwise every room is still busy, so open a new one. A meeting ending at 10:30 frees its room for one starting at 10:30, which is why the test is less than or equal.
Push the new meeting's end time. A reuse pops one and pushes one, so the heap only grows when a room opens, and its size at the end is the answer.
The page opens on Team day (Generate New cycles through two more days): Planning 9:00 to 10:00, Design review 9:30 to 10:30, Interview 10:00 to 11:30, a 1:1 10:15 to 11:00, Demo 10:30 to 12:00, Sync 11:15 to 12:00 and Lunch 11:45 to 12:30. Planning opens room 1. Design review starts at 9:30 while the earliest end is 10:00, so it opens room 2. Interview starts at 10:00, exactly when Planning ends, so it pops 10:00 and takes room 1. The 1:1 at 10:15 sees an earliest end of 10:30 and opens room 3. Demo takes room 2 the moment Design review ends at 10:30. Sync takes room 3, freed at 11:00, and Lunch takes room 1, freed at 11:30. The answer is 3 rooms. With a strict less-than test, Demo could not take Design review's room at 10:30 and the same day would need 4.
Time: sorting costs O(N log N), and each of the N meetings then does at most one pop and one push on a heap of at most N end times. Space: if every meeting overlaps every other, the heap holds all N end times at once.