10 lines Python code beats %96.
\nclass Solution(object):\n    def maxEnvelopes(self, envelopes):\n        des_ht = [a[1] for a in sorted(envelopes, key = lambda x: (x[0], -x[1]))]\n        dp
```\nclass Solution(object):\n    def maxEnvelopes(self, envelopes):\n        des_ht = [a[1] for a in sorted(envelopes, key = lambda x: (x[0], -x[1]))]\n        dp, l = [0] * len(des_ht), 0\n        for x in des_ht:\n            i = bisect.bisect_left(dp, x, 0, l)\n            dp[i] = x\n            if i == l:\n                l+=1\n        return l\n```
[]