Loading...
Loading...
Loading...
A hall has booking requests with a start and an end hour. Bookings may touch at one hour. Print the smallest number of bookings to cancel so that no two of the remaining bookings overlap.
Example 1
Input
4 1 2 2 3 3 4 1 3
Output
1
Example 2
Input
3 1 2 1 2 1 2
Output
2
Try the problem first. Open one hint at a time.
What you cancel is everything you do not keep.
Keep as many as possible: sort by end time and take each request that starts at or after the last end.
Write your Python code, run it on the examples and submit it to hidden tests.
Solve in the editor