Meeting Rooms II
On this page
Problem statement
Given a list of meetings as [start, end] times, return the minimum number of conference rooms needed so that no two meetings in the same room overlap. A meeting that ends at time t frees its room for a meeting that starts at t.
This is the classic "how many things happen at once" question, and it shows up in many forms: servers needed for jobs, platforms for trains, CPU cores for tasks. Original problem: LeetCode 253 (premium).
Example

Input: [[0, 30], [5, 10], [15, 20]]
Output: 2
Input: [[7, 10], [2, 4]]
Output: 1
Constraints (assumed)
- 0 ≤ n ≤ 10,000.
- 0 ≤ start < end ≤ 10⁶.
What this question tests
- Translating the story into "the maximum number of overlapping intervals".
- Using sorting plus a heap (or two sorted arrays) to track what's active.
- Boundary handling: does ending at 10 conflict with starting at 10?
Questions to ask first
- Does a meeting ending at t conflict with one starting at t? (Here: no, the room is free.)
- Is the input sorted? (Here: no.)
- Do you need the room assignment or just the count? (Here: the count.)
- How large are the times? Large times rule out an array indexed by time.
Try it yourself first
You have the full problem. Sketch your answer, then sign up free to read the complete walkthrough.
- The complete design, flow by flow, with pictures
- Deep dives into the hard parts
- What mid, senior and staff candidates are expected to say
- Full company question lists
Free forever. No card needed.