Contained Interval
You are given a two-dimensional list of integers intervals
where each element is an inclusive interval [start, end]
. Return whether there’s an interval which contains another interval.
Constraints
n ≤ 100,000
wheren
is the length ofintervals
.
https://binarysearch.com/problems/Contained-Interval
Examples
Example 1
Input
- intervals =
[[ 1, 3],
[ 4,10],
[ 4, 8],
[ 9, 9]]
Output
- answer =
True
Explanation
[4, 10]
contains [4, 8]
.
Example 2
Input
- intervals =
[[ 1, 3],
[ 4,10],
[ 7,12]]
Output
- answer =
False
Explanation
No interval completely contains another.
Example 3
Input
- intervals =
[[1,5],
[1,5]]
Output
- answer =
True
Leave a comment