mine and theirs. Each interval [start, end] is closed, meaning it includes both ends. Within each list the intervals do not overlap or touch, and they are sorted in increasing order.
Find every stretch of time when both are free, that is, the intersections of intervals from mine with intervals from theirs. Return them in increasing order. An intersection may be a single point, such as [5, 5].mine=[[9, 12], [14, 17]], theirs=[[10, 15], [17, 19]] → [[10, 12], [14, 15], [17, 17]]
[9, 12] and [10, 15] give [10, 12]; [14, 17] and [10, 15] give [14, 15]; [14, 17] and [17, 19] touch at a single point, giving [17, 17].
mine=[[0, 3]], theirs=[[5, 8]] → []
The intervals do not meet, so there is no common time.
mine=[[2, 20]], theirs=[[3, 4], [6, 6], [18, 25]] → [[3, 4], [6, 6], [18, 20]]
len(mine), len(theirs) ≤ 10⁴start ≤ end ≤ 10⁹mine=[[9, 12], [14, 17]], theirs=[[10, 15], [17, 19]]
[[10, 12], [14, 15], [17, 17]]
Run checks the first 3 tests in your browser. Submit checks all 90 tests on the server, hidden ones included.