当前位置:网站首页>Leetcode 300. longest increasing subsequence
Leetcode 300. longest increasing subsequence
2022-07-22 20:12:00 【henujolly】
class Solution {
public:
int lengthOfLIS(vector<int>& nums) {
vector<int>dp(nums.size());
int maxx=1;
for(int i=0;i<nums.size();i++){
dp[i]=1;
for(int j=0;j<i;j++){
if(nums[i]>nums[j]&&(dp[j]+1>dp[i])){
dp[i]=dp[j]+1;
}
}
maxx=max(maxx,dp[i]);
}
return maxx;
}
};
边栏推荐
- Appstore upload screenshot size
- NC4 判断链表中是否有环
- Shutter 2 Advanced (II): shutter air safety
- NC26 括号生成
- Fluent 2 Advanced (V):json_ Serializable use
- leetcode 22. 括号生成
- Kotlin learning 3: common writing methods of pages
- Creation of sparksql dataset
- Kotlin学习一:变量、函数、条件语句与循环语句
- Host Ping fails in VMware NAT mode virtual machine: different from most methods
猜你喜欢
AttributeError: module ‘tensorflow.keras. utils‘ has no attribute image_ dataset_ from_ Directory - solution
使用CSDN-markdown编辑器入门
Simple use of JVM's JPS
蓝桥杯省赛训练营——常用STL
Creation of sparksql dataset
Typora下载和简单使用教程
When the appsstore transporter uploads, it is stuck in the process of verifying the problem
Flutter 2进阶(一):Flutter实用技巧
如何将Word转化为Markdown文本
Open MySQL binlog log on Linux
随机推荐
Shutter 2 Advanced (II): shutter air safety
【读书笔记】《MySQL体系结构和存储引擎》
Kotlin学习一:变量、函数、条件语句与循环语句
appstore 上传屏幕快照尺寸
euler五十讲(一)
NC54 三数之和
Open MySQL binlog log on Linux
Fluent 2 Advanced (IV): Based on navigator 2.0 packaging
蓝桥杯省赛训练营——栈与递归
if else优化
Creation of sparksql dataset
如何将Word转化为Markdown文本
HDU 3351:Seinfeld
Host Ping fails in VMware NAT mode virtual machine: different from most methods
Persistence of spark RDD (cache, checkpoints, broadcast variables, and accumulators)
Kotlin learning 3: common writing methods of pages
ld: framework not found Pods_ XXX clang: error: linker command failed with exit code 1 (use -v to see
Spark loads CSV and JSON files (attached to the virtual machine to execute the jar package)
Daily work specifications
2017年终总结