Loading...
Loading...
Loading...
A company has n meetings with a start and an end time. A meeting occupies a room from its start up to, but not including, its end, so a meeting that starts when another ends can use the same room. Print the smallest number of rooms needed.
Example 1
Input
4 0 30 5 10 15 20 10 15
Output
2
The long meeting runs all along, so two rooms are enough.
Example 2
Input
2 1 2 2 3
Output
1
Try the problem first. Open one hint at a time.
Sort the meetings by start time.
Keep a min-heap of end times of rooms in use. Free the room that ends first if it ends by the new start.
Write your Python code, run it on the examples and submit it to hidden tests.
Solve in the editor