```
class Solution {
public:
int findLongestChain(vector<vector<int>>& pairs) {
sort(pairs.begin(), pairs.end(), [](vector<int> f, vector<int> s){return f[1] < s[1];});
int res = 1, last = 0;
for (int i = 0; i < pairs.size(); i++) {
if (pairs[i][0] > pairs[last][1]) {
last = i;
res++;
}
}
return res;
}
};
```