Short and simple Java solution (15 lines)
\n    public int maxEnvelopes(int[][] envelopes) {\n        Arrays.sort(envelopes, (a, b) -> a[0] - b[0]);\n        int max = 0;\n        int dp [] = new int [e
 \n    public int maxEnvelopes(int[][] envelopes) {\n        Arrays.sort(envelopes, (a, b) -> a[0] - b[0]);\n        int max = 0;\n        int dp [] = new int [envelopes.length];\n        for(int i = 0; i < envelopes.length; i++){\n            dp[i] = 1;\n            for(int j = 0; j < i; j++){\n                if(envelopes[j][0] < envelopes[i][0] && envelopes[j][1] < envelopes[i][1])\n                    dp[i] = Math.max(dp[i], dp[j] + 1);\n            }\n            max = Math.max(dp[i], max);\n        }\n        return max;\n    }
['Java']