Meeting Rooms II
Solve this the way you would in the interview: out loud, on a timer, with an AI interviewer asking follow-ups while you code. You get a scored report at the end.
Practice this as a mock interviewFree to start, no account neededProblem
You are given a list of meetings, where each meeting is described by a pair [start, end] representing the time the meeting begins and the time it ends. Your task is to determine the minimum number of meeting rooms required so that every meeting can take place without two meetings ever sharing a room at the same time.
The input intervals is a 2D array where intervals[i] = [start_i, end_i] with start_i < end_i. Treat the end time as **exclusive**: a meeting that ends exactly when another begins does **not** overlap with it, so the two can reuse the same room. For example, a meeting [5, 10] and a meeting [10, 15] can share one room.
Return the smallest number of rooms that can host all of the meetings.
Examples
Constraints
- `0 <= intervals.length <= 10^4`
- `intervals[i].length == 2`
- `0 <= start_i < end_i <= 10^6`
- An empty list of meetings requires `0` rooms.
What the interviewer grades
A correct solution is one of five scores. The report also grades problem understanding (did you clarify inputs and edge cases before coding), problem solving, communication while you work, code quality, and testing. See a sample report, or read up on the pattern in the lessons.