Code RoomRoom booking conflicts
EasyPrep Room Coding #4836

Room booking conflicts

CodingAlgorithms & data structuresEntry–Mid~15 min

A rehearsal room takes bookings for a single day. Each entry of confirmed is a booking already on the calendar, written as "09:00|10:30": a start time, a pipe, then an end time, both on a 24 hour clock as hours and minutes. A booking holds the room from its start up to but not including its end, so two bookings that touch at exactly one endpoint do not clash. The confirmed list arrives in no particular order and its bookings may already overlap each other. Each entry of proposals has the same shape and asks whether that slot could be added without clashing with any confirmed booking. Every booking ends strictly after it starts. Return one answer per proposal, in the order the proposals are given, true when the room is free for the whole slot.

Implement
booking_fit_flags(confirmed: list[str], proposals: list[str]) → list[bool]
Examples
in[["09:00|10:30","13:15|14:00","16:00|17:30"],["10:30|11:00","10:00|10:45","14:00|16:00"]]out[true,false,true]
in[[],["08:00|09:00","00:00|23:59"]]out[true,true]
in[["09:00|10:00"],["08:00|09:00","10:00|11:00","08:30|09:30"]]out[true,true,false]
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 15 min
InputExpectedGot
[["09:00|10:30","13:15|14:00","16:00|17:30"],["10:30|11:00","10:00|10:45","14:00|16:00"]][true,false,true]not run yetsample
[[],["08:00|09:00","00:00|23:59"]][true,true]not run yetsample
[["09:00|10:00"],["08:00|09:00","10:00|11:00","08:30|09:30"]][true,true,false]not run yetsample