Sort + LIS | C++
\nclass Solution {\n    static bool cmp(vector<int> &a, vector<int> &b) {\n        return a[0] == b[0] ? a[1] > b[1] : a[0] < b[0];\n    }\npublic:\n    int max
```\nclass Solution {\n    static bool cmp(vector<int> &a, vector<int> &b) {\n        return a[0] == b[0] ? a[1] > b[1] : a[0] < b[0];\n    }\npublic:\n    int maxEnvelopes(vector<vector<int>>& envelopes) {\n        sort(envelopes.begin(), envelopes.end(), cmp);\n\n        vector<int> v;\n        for(auto e : envelopes) {\n            if(!v.size() || v.back() < e[1]) v.push_back(e[1]);\n            else {\n                int pos = lower_bound(v.begin(), v.end(), e[1]) - v.begin();\n                v[pos] = e[1];\n            }\n        }\n        return v.size();\n    }\n};\n\n\n```
['Binary Search', 'Sorting', 'C++']