Intersection of availabilities
Two tutors publish availability for the same day as closed minute intervals [start, end] — each list sorted by start and internally non-overlapping. A joint session can run whenever both are free. Return every window when both are available, as [start, end] pairs sorted by start. Include moment-long windows where the availabilities merely touch (the result may contain [x, x]). Example: [[0,2],[5,10]] and [[1,5],[8,12]] gives [[1,2],[5,5],[8,10]].
Implement
joint_windows(a: list[list[int]], b: list[list[int]]) → list[list[int]]Examples
in
[[[0,2],[5,10]],[[1,5],[8,12]]]out[[1,2],[5,5],[8,10]]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
solution.py
InputExpectedGot
[[[0,2],[5,10]],[[1,5],[8,12]]][[1,2],[5,5],[8,10]]not run yetsample