Code RoomMaximum booking overlap
MediumPrep Room Coding #1219

Maximum booking overlap

CodingAlgorithms & data structuresMid–Senior~25 min

Implement a calendar that processes a sequence of bookings, each a half-open interval [start, end). After each booking, you must report the maximum number of bookings that overlap at any single point in time across ALL bookings so far (the 'k-booking' level). Given the list of bookings in order, return a list whose i-th element is that running maximum after the i-th booking is added. Use a sweep over interval endpoints (a count delta of +1 at start, -1 at end).

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 25 min
InputExpectedGot
[[[10,20],[50,60],[10,40],[5,15],[5,10],[25,55]]][1,1,2,3,3,3]not run yetsample