Code Room
CodingMediumcod-g1462
Subject IntervalsLevel Entry–Mid~15 minCommon in Algorithms & data structures interviewsIndustries Software development

Question

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.

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.