15 September 2026 · Advanced track
Busiest Rehearsal Room
Advanced
Dictionaries
Records
Find the rehearsal room with the most booked minutes, using its final booking position to break a tie.
A community theatre records room bookings in the order they are received. Each booking contains a room name and its number of booked minutes. Add the booked minutes for each room. Return the room with the largest total number of booked minutes. If rooms tie for the largest total, return the room whose final booking appears earlier in the booking list.
Constraints
bookings contains from 1 to 1,000 recordsEach room name contains from 1 to 30 lowercase ASCII lettersminutes is an integer from 1 to 10,000
Function signature
def busiest_room(bookings):