<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>< right<sub>i</sub></code>.</p>
<p>A pair <code>p2 = [c, d]</code><strong>follows</strong> a pair <code>p1 = [a, b]</code> if <code>b < c</code>. A <strong>chain</strong> of pairs can be formed in this fashion.</p>
<p>Return <em>the length longest chain which can be formed</em>.</p>
<p>You do not need to use up all the given intervals. You can select pairs in any order.</p>