Skip to content

Commit 6514b72

Browse files
committed
Create README - LeetHub
1 parent fa2a003 commit 6514b72

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<h2><a href="https://leetcode.com/problems/maximum-length-of-pair-chain">646. Maximum Length of Pair Chain</a></h2><h3>Medium</h3><hr><p>You are given an array of <code>n</code> pairs <code>pairs</code> where <code>pairs[i] = [left<sub>i</sub>, right<sub>i</sub>]</code> and <code>left<sub>i</sub> &lt; right<sub>i</sub></code>.</p>
2+
3+
<p>A pair <code>p2 = [c, d]</code> <strong>follows</strong> a pair <code>p1 = [a, b]</code> if <code>b &lt; c</code>. A <strong>chain</strong> of pairs can be formed in this fashion.</p>
4+
5+
<p>Return <em>the length longest chain which can be formed</em>.</p>
6+
7+
<p>You do not need to use up all the given intervals. You can select pairs in any order.</p>
8+
9+
<p>&nbsp;</p>
10+
<p><strong class="example">Example 1:</strong></p>
11+
12+
<pre>
13+
<strong>Input:</strong> pairs = [[1,2],[2,3],[3,4]]
14+
<strong>Output:</strong> 2
15+
<strong>Explanation:</strong> The longest chain is [1,2] -&gt; [3,4].
16+
</pre>
17+
18+
<p><strong class="example">Example 2:</strong></p>
19+
20+
<pre>
21+
<strong>Input:</strong> pairs = [[1,2],[7,8],[4,5]]
22+
<strong>Output:</strong> 3
23+
<strong>Explanation:</strong> The longest chain is [1,2] -&gt; [4,5] -&gt; [7,8].
24+
</pre>
25+
26+
<p>&nbsp;</p>
27+
<p><strong>Constraints:</strong></p>
28+
29+
<ul>
30+
<li><code>n == pairs.length</code></li>
31+
<li><code>1 &lt;= n &lt;= 1000</code></li>
32+
<li><code>-1000 &lt;= left<sub>i</sub> &lt; right<sub>i</sub> &lt;= 1000</code></li>
33+
</ul>

0 commit comments

Comments
 (0)