class Solution {

public int findLongestChain(int[][] pairs) {

Arrays.sort(pairs, (a, b) -> (a[1] - b[1]));

```
int result = 1;
int tail = 0;
for (int i = 1; i < pairs.length; i++) {
if (pairs[i][0] > pairs[tail][1]) {
result++;
tail = i;
} else {
continue;
}
}
return result;
}
```

}