Python 6 lines bisect solution
I don\'t go much into details. \n The method is all over the discussion, "longest increasing subsequence" tail method.\n We simply catch the minimum height for 
* I don\'t go much into details. \n* The method is all over the discussion, "longest increasing subsequence" tail method.\n* We simply catch the minimum height for specified number of dolls or length of tails in other words.\n* We reversed heights of same widths in envelopes array because it would continue adding another doll onto same width.\n```\nclass Solution:\n    def maxEnvelopes(self, envelopes):\n        tails = []\n        for w, h in sorted(envelopes, key = lambda x: (x[0], -x[1])):\n            i = bisect.bisect_left(tails, h)\n            if i == len(tails): tails.append(h)\n            else: tails[i] = h\n        return len(tails)\n```
[]