Code RoomRoom free windows
MediumPrep Room Coding #672

Room free windows

CodingAlgorithms & data structuresEntry–Mid~14 min

A conference room's bookings for one day are [start, end] pairs occupying half-open spans [start, end) — unsorted, possibly overlapping, and all inside the building's open hours [open_time, close_time]. Return the room's free windows within open hours as [start, end] pairs sorted by start, skipping zero-length windows. Example: bookings [[9,10],[12,13]] with hours 8 to 18 give [[8,9],[10,12],[13,18]].

Implement
free_windows(meetings: list[list[int]], open_time: int, close_time: int) → list[list[int]]
Examples
in[[[9,10],[12,13]],8,18]out[[8,9],[10,12],[13,18]]
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 14 min
InputExpectedGot
[[[9,10],[12,13]],8,18][[8,9],[10,12],[13,18]]not run yetsample