Simple Dp LIS Box Stacking
It is a simple application of Longest Increasing subsequence. \nYou Just have to increase the sequence with a smaller element. \nThere is also a NlogN solution 
It is a simple application of Longest Increasing subsequence. \nYou Just have to increase the sequence with a smaller element. \nThere is also a NlogN solution do check it out!\n\n```\n\tstatic bool compare(pair<int,pair<int,int>>& a,pair<int,pair<int,int>>& b){\n        return a.first>b.first;\n    }\n    \n    int maxEnvelopes(vector<vector<int>>& env) {\n        int n=env.size();\n        vector<int> dp(n,1);\n        vector<pair<int,pair<int,int>>> envs;\n        for(int i=0;i<n;i++){\n            envs.push_back({env[i][0]*env[i][1],{env[i][0],env[i][1]}});\n        }\n        \n        sort(envs.begin(),envs.end(),compare);\n        \n        for(int i=1;i<n;i++){\n            for(int j=i-1;j>=0;j--){\n                if(envs[j].second.first>envs[i].second.first && envs[j].second.second>envs[i].second.second){\n                    dp[i]=max(dp[i],dp[j]+1);\n                }\n            }\n        }\n        \n        return *max_element(dp.begin(),dp.end());\n    }\n\t```
['Dynamic Programming']