Class Solution
java.lang.Object
g1801_1900.s1893_check_if_all_the_integers_in_a_range_are_covered.Solution
1893 - Check if All the Integers in a Range Are Covered.<p>Easy</p>
<p>You are given a 2D integer array <code>ranges</code> and two integers <code>left</code> and <code>right</code>. Each <code>ranges[i] = [start<sub>i</sub>, end<sub>i</sub>]</code> represents an <strong>inclusive</strong> interval between <code>start<sub>i</sub></code> and <code>end<sub>i</sub></code>.</p>
<p>Return <code>true</code> <em>if each integer in the inclusive range</em> <code>[left, right]</code> <em>is covered by <strong>at least one</strong> interval in</em> <code>ranges</code>. Return <code>false</code> <em>otherwise</em>.</p>
<p>An integer <code>x</code> is covered by an interval <code>ranges[i] = [start<sub>i</sub>, end<sub>i</sub>]</code> if <code>start<sub>i</sub> <= x <= end<sub>i</sub></code>.</p>
<p><strong>Example 1:</strong></p>
<p><strong>Input:</strong> ranges = [[1,2],[3,4],[5,6]], left = 2, right = 5</p>
<p><strong>Output:</strong> true</p>
<p><strong>Explanation:</strong> Every integer between 2 and 5 is covered:</p>
<ul>
<li>
<p>2 is covered by the first range.</p>
</li>
<li>
<p>3 and 4 are covered by the second range.</p>
</li>
<li>
<p>5 is covered by the third range.</p>
</li>
</ul>
<p><strong>Example 2:</strong></p>
<p><strong>Input:</strong> ranges = [[1,10],[10,20]], left = 21, right = 21</p>
<p><strong>Output:</strong> false</p>
<p><strong>Explanation:</strong> 21 is not covered by any range.</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 <= ranges.length <= 50</code></li>
<li><code>1 <= start<sub>i</sub> <= end<sub>i</sub> <= 50</code></li>
<li><code>1 <= left <= right <= 50</code></li>
</ul>
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
isCovered
public boolean isCovered(int[][] ranges, int left, int right)
-