rooms meeting rooms numbered 0 to rooms - 1. You get a list meetings, where meetings[i] = [start, end] means the meeting is planned for the half-open time interval [start, end). All start values are distinct.
Meetings are assigned like this:
- a meeting goes to the free room with the lowest number;
- if no room is free, the meeting waits until one frees up and then lasts as long as originally planned;
- when a room frees up, the waiting meeting with the earliest original start time gets it first.
Return the number of the room that hosted the most meetings. If several rooms tie, return the lowest number.rooms=2, meetings=[[1, 6], [0, 4], [2, 3], [5, 8]] → 0
At time 0 meeting [0, 4) takes room 0, and at time 1 meeting [1, 6) takes room 1. Meeting [2, 3) finds no room; room 0 frees up at time 4, so it runs there as [4, 5). Meeting [5, 8) gets room 0 again at time 5. Room 0 hosts three meetings and room 1 just one.
rooms=2, meetings=[[0, 10], [1, 3], [4, 6], [7, 9]] → 1
A long meeting holds room 0 until time 10, while the three short ones take turns in room 1. The answer is 1.
rooms=3, meetings=[[0, 9], [1, 9], [2, 4], [5, 7], [8, 9]] → 2
rooms=2, meetings=[[1, 6], [0, 4], [2, 3], [5, 8]]
0
Run checks the first 3 tests in your browser. Submit checks all 76 tests on the server, hidden ones included.