Calendar max bookings
Implement MyCalendarThree as a single function: given a chronological list of [start, end) booking requests, every request is accepted (overlaps allowed). After each booking, the 'k-booking' is the maximum number of bookings that overlap at any single point. Return a list whose i-th element is the maximum k-booking after the first i+1 bookings have been added. Times are in [0, 10^9) and there are up to 400 bookings.
Implement
calendar_three(bookings: list[list[int]]) → list[int]Examples
in
[[[10,20],[50,60],[10,40],[5,15],[5,10],[25,55]]]out[1,1,2,3,3,3]What a strong answer looks like
State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
0:00 of about 30 min
solution.py
InputExpectedGot
[[[10,20],[50,60],[10,40],[5,15],[5,10],[25,55]]][1,1,2,3,3,3]not run yetsample