Interval Overlaps
You are given a list of closed intervals l0
and another list of intervals l1
. Individually, each list is non-overlapping and are sorted in ascending order.
Return the overlap of the two intervals sorted in ascending order.
Constraints
n ≤ 100,000
wheren
is the length ofl0
m ≤ 100,000
wherem
is the length ofl1
https://binarysearch.com/problems/Interval-Overlaps
Examples
Example 1
Input
- l0 =
[[1,3],
[5,6],
[7,9]]
- l1 =
[[1,4],
[5,7]]
Output
- answer =
[[1, 3], [5, 6], [7, 7]]
Example 2
Input
- l0 =
[[1,3],
[5,6],
[7,9]]
- l1 =
[[100,200]]
Output
- answer =
[]
Leave a comment