参考:https://algorithm.yuanbin.me/zh-hans/dynamic_programming/longest_increasing_subsequence.html
class Solution {
public:
int lengthOfLIS(vector<int>& nums) {
vector<int> dp(nums.size(), 1);
int n = nums.size();
int max = 0;
for(int i = 0; i < n; i++){
for(int j = 0; j < i; j++){
if(nums[j] < nums[i] && dp[j] >= dp[i]){
dp[i] = dp[j] + 1;
}
}
if(dp[i] >max) max = dp[i];
}
return max;
}
};