Skip to content

Commit ae98d60

Browse files
Create README - LeetHub
1 parent 41c1168 commit ae98d60

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<h2><a href="https://leetcode.com/problems/non-overlapping-intervals">435. Non-overlapping Intervals</a></h2><h3>Medium</h3><hr><p>Given an array of intervals <code>intervals</code> where <code>intervals[i] = [start<sub>i</sub>, end<sub>i</sub>]</code>, return <em>the minimum number of intervals you need to remove to make the rest of the intervals non-overlapping</em>.</p>
2+
3+
<p><strong>Note</strong> that intervals which only touch at a point are <strong>non-overlapping</strong>. For example, <code>[1, 2]</code> and <code>[2, 3]</code> are non-overlapping.</p>
4+
5+
<p>&nbsp;</p>
6+
<p><strong class="example">Example 1:</strong></p>
7+
8+
<pre>
9+
<strong>Input:</strong> intervals = [[1,2],[2,3],[3,4],[1,3]]
10+
<strong>Output:</strong> 1
11+
<strong>Explanation:</strong> [1,3] can be removed and the rest of the intervals are non-overlapping.
12+
</pre>
13+
14+
<p><strong class="example">Example 2:</strong></p>
15+
16+
<pre>
17+
<strong>Input:</strong> intervals = [[1,2],[1,2],[1,2]]
18+
<strong>Output:</strong> 2
19+
<strong>Explanation:</strong> You need to remove two [1,2] to make the rest of the intervals non-overlapping.
20+
</pre>
21+
22+
<p><strong class="example">Example 3:</strong></p>
23+
24+
<pre>
25+
<strong>Input:</strong> intervals = [[1,2],[2,3]]
26+
<strong>Output:</strong> 0
27+
<strong>Explanation:</strong> You don&#39;t need to remove any of the intervals since they&#39;re already non-overlapping.
28+
</pre>
29+
30+
<p>&nbsp;</p>
31+
<p><strong>Constraints:</strong></p>
32+
33+
<ul>
34+
<li><code>1 &lt;= intervals.length &lt;= 10<sup>5</sup></code></li>
35+
<li><code>intervals[i].length == 2</code></li>
36+
<li><code>-5 * 10<sup>4</sup> &lt;= start<sub>i</sub> &lt; end<sub>i</sub> &lt;= 5 * 10<sup>4</sup></code></li>
37+
</ul>

0 commit comments

Comments
 (0)