medium +30 pts

Meeting Rooms Minimum

Find the minimum number of meeting rooms needed to hold all intervals.

You are given a list of meeting time intervals, where each interval is a list [start, end] (with start < end). All times are integers. Meetings can start exactly when another meeting ends (i.e., intervals [1,3] and [3,5] can share the same room). Your task is to implement the function `min_meeting_rooms(intervals: list[list[int]]) -> int` that returns the minimum number of conference rooms required to host all meetings without any time overlap in the same room. You must provide a solution that is efficient enough for large inputs and does not use external libraries.

Constraints

1 <= len(intervals) <= 10^5 0 <= start < end <= 10^9

Example

>>> min_meeting_rooms([[0,30],[5,10],[15,20]])
2
>>> min_meeting_rooms([[7,10],[2,4]])
1
>>> min_meeting_rooms([[1,5],[2,6],[3,7]])
3
>>> min_meeting_rooms([])
0
30 points ~25 min

Recent Submissions

No submissions yet — hit Run Tests to try!

Hints

Think about time points: what events happen at each start and end?
Sort all start and end times separately, then use two pointers.
Alternatively, sort intervals by start time and maintain a min-heap of end times.
For each meeting, if the earliest ending meeting has ended, reuse that room; otherwise allocate a new room.
Python 3
All tests passed!
Test Results
Press Ctrl+Enter or click Run Tests to execute your code.