Meeting Rooms II
Problem
You are given a list of meetings, each a half-open time range [start, end). Every meeting must take place in a room, a room can host only one meeting at a time, and a room freed at time t can be reused by a meeting starting at t. Return the minimum number of rooms needed so that every meeting can be held as scheduled.
- Up to around ten thousand meetings.
- Start and end times are non-negative and fit comfortably in a normal int, with
start < end.
Examples
[[3,20],[8,12],[22,25]]→2. The long meeting occupies one room for the whole span; the other two can share a second room because they do not overlap each other.[[9,12],[1,3]]→1. No overlap at all.[[2,6],[6,9],[3,7]]→2. At time 3 to 6 two meetings run at once;[6,9]can reuse the room freed by[2,6].
Hints
- At any instant, how many rooms are busy? What is the relationship between that number over time and the answer?
- Process meetings in start order. When a new meeting begins, which room would you most like to reuse, and how do you find it fast?
- Min-heap of end times of meetings in progress; or a sweep over sorted start and end events counting concurrent meetings.
Last reviewed 8 September 2026
Approach · Solution (Python) · Complexity · Follow-ups · Company variations · Tests
The rest of this question — the worked approach, the Python solution with passing tests, complexity, follow-ups and how each company frames it — is part of the guides.
Get the full guide
Pick the company you're interviewing with. Each guide has every question tiered for that loop — one-time purchase, lifetime access.
Also in: Apple, Google, Meta, Microsoft, Netflix
Interviewing at more than one? All 6 guides for $499 · save $395
Not ready to buy? Get the free starter pack — 13 questions with full solutions.