当前位置:网站首页>Force buckle 674 Longest continuous increasing sequence
Force buckle 674 Longest continuous increasing sequence
2022-07-07 20:06:00 【Tomorrowave】
674. The longest continuous increasing sequence
Given an unordered array of integers , Find the longest and Successive increasing subsequences , And return the length of the sequence .
Successive increasing subsequences It can be made up of two subscripts l and r(l < r) determine , If for each l <= i < r, There are nums[i] < nums[i + 1] , So the subsequence [nums[l], nums[l + 1], …, nums[r - 1], nums[r]] It's a continuous increasing subsequence .
### Knowledge points involved
Dynamic programming
class Solution:
def findLengthOfLCIS(self, nums: List[int]) -> int:
ans=[1 for _ in range(len(nums))]
for i in range(1,len(nums)):
if nums[i]>nums[i-1]:
ans[i]=ans[i-1]+1
return max(ans)
边栏推荐
- [sword finger offer] sword finger offer II 012 The sum of left and right subarrays is equal
- Dynamic addition of El upload upload component; El upload dynamically uploads files; El upload distinguishes which component uploads the file.
- 841. String hash
- [confluence] JVM memory adjustment
- R语言ggplot2可视化:使用ggpubr包的ggecdf函数可视化分组经验累积密度分布函数曲线、linetype参数指定不同分组曲线的线型
- pom. Brief introduction of XML configuration file label function
- 开源重器!九章云极DataCanvas公司YLearn因果学习开源项目即将发布!
- YoloV6:YoloV6+Win10---训练自己得数据集
- JVM class loading mechanism
- 力扣 643. 子数组最大平均数 I
猜你喜欢
随机推荐
831. KMP字符串
PMP每日一练 | 考试不迷路-7.7
JVM GC garbage collection brief
线性基
MySQL、sqlserver oracle数据库连接方式
equals 方法
力扣 1037.有效的回旋镖
9 原子操作类之18罗汉增强
Equals method
Sword finger offer II 013 Sum of two-dimensional submatrix
pom. XML configuration file label: differences between dependencies and dependencymanagement
浏览积分设置的目的
The project manager's "eight interview questions" is equal to a meeting
Some important knowledge of MySQL
力扣 88.合并两个有序数组
小试牛刀之NunJucks模板引擎
力扣 1961. 检查字符串是否为数组前缀
九章云极DataCanvas公司摘获「第五届数字金融创新大赛」最高荣誉!
Navicat连接2002 - Can‘t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock‘解决
2022如何评估与选择低代码开发平台?