Problem
There are n rooms numbered 0 to n - 1. meetings[i] = [start_i, end_i] describes a meeting over the half-open time range [start, end). All start times are different. Meetings are assigned like this:
1. Each meeting goes to the free room with the lowest number. 2. If no room is free, the meeting is delayed until a room frees up, keeping its original duration. If several meetings are waiting, the one with the earlier original start goes first. 3. When a room frees up, the waiting meeting takes it; if several rooms free up at the same time, it takes the lowest-numbered one.
Return the room that held the most meetings. On a tie, return the lowest room number.
Example 1
- Input
- n = 2, meetings = [[0, 10], [1, 5], [2, 7], [3, 4]]
- Output
- 0
Room 0 takes [0, 10), room 1 takes [1, 5). [2, 7) waits for room 1 and runs [5, 10). [3, 4) waits and runs [10, 11) in room 0. Both rooms hold 2 meetings, so the answer is 0.
Constraints
1 <= n <= 1001 <= meetings.length <= 10^50 <= start_i < end_i <= 5 * 10^5All values of start_i are unique.