Booking clash detection
A gym studio's confirmed bookings are half-open time slots [start, end) in minutes, pairwise non-overlapping but stored in no particular order. A new request [start, end) arrives. Return True if the request clashes with any existing booking. Sharing only an endpoint — a class that ends exactly when another begins — is not a clash. Example: bookings [[60,120],[150,180]] with request [120,150] is False.
Implement
booking_conflicts(bookings: list[list[int]], request: list[int]) → boolExamples
in
[[[60,120],[150,180]],[120,150]]outfalseWhat 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 10 min
solution.py
InputExpectedGot
[[[60,120],[150,180]],[120,150]]falsenot run yetsample