Hard · System Design
Meeting Rooms III
Given n rooms numbered 0 to n−1 and meetings [start, end) with distinct start times, book the meetings in start order. Each goes to the lowest-numbered free room; if none is free, it is delayed, keeping its duration, into the room that frees first (lowest number on ties). Return the room that held the most meetings, lowest number on ties.
Examples
Example 1
{
"n": 2,
"meetings": [
[0, 10],
[1, 5],
[2, 7],
[3, 4]
]
}Output: room 0
Example 2
{
"n": 2,
"meetings": [
[5, 6],
[0, 5],
[1, 3]
]
}Output: room 0
Rebuild it in the studio
Open every published interview problem, solution, scene, and memory room free, with no account.