Longest Interval
You are given a two-dimensional list of integers intervals
where each list represents an inclusive [start, end]
interval. Return the longest interval that you can make by merging any number of intersecting intervals.
Constraints
n ≤ 100,000
wheren
is the length ofintervals
https://binarysearch.com/problems/Longest-Interval
Examples
Example 1
Input
- intervals =
[[ 1, 5],
[ 3, 8],
[ 4, 5],
[10,13],
[15,17]]
Output
- answer =
8
Explanation
After merging, we have the interval [1, 8]
which has a length of 8
Leave a comment