Trains the technique from
LeetCode 986Interval List IntersectionsThis is an original problem, written from a brief that listed the technique, the difficulty, the topics, the function shape and the input bounds — none of that problem's wording, examples, hints or editorials. The link is there so you can map your practice onto the standard set.
Same function shape, different story and different numbers.
Two telescopes, one under the dome and one out on the ridge, each publish tonight's clear-sky windows as minute marks counted from dusk. dome and ridge hold those windows as [opens, closes] pairs, already ordered by opening mark, and no two windows in the same schedule ever touch: every window closes strictly before the next one in that schedule opens.
A paired reading needs both telescopes clear at once. Report every stretch of time that both schedules cover, again as [opens, closes] pairs ordered by opening mark. A stretch that comes down to a single minute mark, where opens equals closes, still counts as coverage and must be reported.
Either schedule may be empty, though not both. When the two schedules never coincide, return an empty list.
Example 1
The first two windows meet only at mark 6, which still counts, and the later pair overlaps from mark 13 until the dome window closes at 14.
Example 2
One long dome window swallows the first two ridge windows whole and clips the third at mark 20.
Example 3
The dome window has already closed before the ridge window opens, so nothing is covered twice.
The editor is preloaded with this. It matches the parent problem's shape, so a solution that works here transfers to a judge unchanged.
def shared_windows(dome: list[list[int]], ridge: list[list[int]]) -> list[list[int]]:public int[][] sharedWindows(int[][] dome, int[][] ridge)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.