Question
Given an array intervals
where intervals[i] = [li, ri]
represent the interval [li, ri)
, remove all intervals that are covered by another interval in the list.
The interval [a, b)
is covered by the interval [c, d)
if and only if c <= a
and b <= d
.
Return the number of remaining intervals.
https://leetcode.com/problems/remove-covered-intervals/
- Solution1
1 | class Solution { |
Complexity:
Time complexity: O( nlogn)
Space complexity: O(1)