Class Solution
java.lang.Object
g1201_1300.s1288_remove_covered_intervals.Solution
1288 - Remove Covered Intervals.<p>Medium</p>
<p>Given an array <code>intervals</code> where <code>intervals[i] = [l<sub>i</sub>, r<sub>i</sub>]</code> represent the interval <code>[l<sub>i</sub>, r<sub>i</sub>)</code>, remove all intervals that are covered by another interval in the list.</p>
<p>The interval <code>[a, b)</code> is covered by the interval <code>[c, d)</code> if and only if <code>c <= a</code> and <code>b <= d</code>.</p>
<p>Return <em>the number of remaining intervals</em>.</p>
<p><strong>Example 1:</strong></p>
<p><strong>Input:</strong> intervals = [[1,4],[3,6],[2,8]]</p>
<p><strong>Output:</strong> 2</p>
<p><strong>Explanation:</strong> Interval [3,6] is covered by [2,8], therefore it is removed.</p>
<p><strong>Example 2:</strong></p>
<p><strong>Input:</strong> intervals = [[1,4],[2,3]]</p>
<p><strong>Output:</strong> 1</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 <= intervals.length <= 1000</code></li>
<li><code>intervals[i].length == 2</code></li>
<li><code>0 <= l<sub>i</sub> < r<sub>i</sub> <= 10<sup>5</sup></code></li>
<li>All the given intervals are <strong>unique</strong>.</li>
</ul>
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
removeCoveredIntervals
public int removeCoveredIntervals(int[][] intervals)
-