Java Simple and easy solution, 8 ms, faster than 98.48%, T O nlogn, clean code with comments
PLEASE UPVOTE IF YOU LIKE THIS SOLUTION\n\n\nclass Solution {\n    public int maxEnvelopes(int[][] envelopes) {\n        //sort the enevelope\n        //as incr
**PLEASE UPVOTE IF YOU LIKE THIS SOLUTION**\n\n```\nclass Solution {\n    public int maxEnvelopes(int[][] envelopes) {\n        //sort the enevelope\n        //as increasing of width, when both width is same, then sort  by decreasing order heights\n        Arrays.sort(envelopes, (a, b) ->  (a[0] == b[0]) ? (b[1] - a[1]) : (a[0] - b[0]));\n        \n        //just extarct the height\n        int[] heights = new int[envelopes.length];\n        for(int i = 0; i < heights.length; i++){\n            heights[i] = envelopes[i][1];\n        }\n        \n        //find the longest increasing subsequen on heights\n        return getLIS(heights);\n    }\n    \n    private int getLIS(int[] nums){\n        int[] dp = new int[nums.length];\n        int len = 0;\n        \n        for(int num : nums){\n            int index = Arrays.binarySearch(dp, 0, len, num);\n            \n            if(index < 0){\n                index = -(index + 1);\n            }\n            \n            dp[index] = num;\n            \n            if(index == len)\n                len++;\n        }\n        \n        return len;\n    }\n}\n```
['Java']