#include <vector>
class Stack {
public:
int getHeight(vector<int> men, int n) {
// write code here
vector<int> dp(n,1);
int max_height =0;
for(int i=1;i<n;++i){
for(int j =0;j<i;++j){
if (men[i]>men[j]) {
dp[i]= max(dp[i], dp[j]+1);
}
}
max_height = max(max_height, dp[i]);
}
return max_height;
}
};

京公网安备 11010502036488号