Skip to content

Practice Meeting Rooms III

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Hard#2402
LeetCode Problem

Meeting Rooms III

Problem Statement

There are n rooms numbered 0 through n - 1. Process meetings [start,end] in their distinct original start-time order, with end excluded. Assign a meeting to the lowest-numbered free room; if none is free, delay it until a room frees up, preserving its duration and using the lowest room number on a tie. Earlier original starts have priority among waiting meetings. Return the room holding the most meetings, breaking ties by lowest number.

Source: Meeting Rooms III on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
n = 2, meetings = [[0,10],[1,5],[2,7],[3,4]]
Output
0

# Example 2

Input
n = 3, meetings = [[1,20],[2,10],[3,5],[4,9],[6,8]]
Output
1

Constraints

1 <= n <= 100
1 <= meetings.length <= 10^5
meetings[i].length == 2
0 <= starti < endi <= 5 * 10^5
All the values of starti are unique.

Related LeetCode Problems

Practice more problems similar to Meeting Rooms III.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.