← 返回 atlassian 的题目列表Expanding Tennis Club Booking Assignment
类型:online_judge
Implement a function that, given a list of tennis court bookings with start and finish times, returns a plan assigning each booking to a specific court, ensuring each court is used by only one booking at a time and using the minimum number of courts. An unlimited number of courts are available. After each booking, a fixed amount of time, X, is needed to maintain the court before it can be rented again. Maintenance is required only after X amount of usage.
Class BookingRecord: Id: int # ID of the booking Start_time: int # Start time Finish_time: int # Finish time
Function Signature:
List assignCourts(List bookingRecords)
Example
Input
[{'id': 1, 'start': 0, 'finish': 5}, {'id': 2, 'start': 3, 'finish': 10}, {'id': 3, 'start': 8, 'finish': 15}, {'id': 4, 'start': 12, 'finish': 13}]