当前位置:网站首页>力扣674. 最长连续递增序列
力扣674. 最长连续递增序列
2022-07-07 17:53:00 【Tomorrowave】
674. 最长连续递增序列
给定一个未经排序的整数数组,找到最长且 连续递增的子序列,并返回该序列的长度。
连续递增的子序列 可以由两个下标 l 和 r(l < r)确定,如果对于每个 l <= i < r,都有 nums[i] < nums[i + 1] ,那么子序列 [nums[l], nums[l + 1], …, nums[r - 1], nums[r]] 就是连续递增子序列。
###涉及知识点
动态规划
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)
边栏推荐
- 【STL】vector
- YoloV6:YoloV6+Win10---训练自己得数据集
- vulnhub之tre1
- R language ggplot2 visualization: use the ggdensity function of ggpubr package to visualize the packet density graph, and use stat_ overlay_ normal_ The density function superimposes the positive dist
- 转置卷积理论解释(输入输出大小分析)
- Throughput
- 2022如何评估与选择低代码开发平台?
- Mysql, sqlserver Oracle database connection mode
- The DBSCAN function of FPC package of R language performs density clustering analysis on data, checks the clustering labels of all samples, and the table function calculates the two-dimensional contin
- pom.xml 配置文件标签作用简述
猜你喜欢

Leetcode force buckle (Sword finger offer 36-39) 36 Binary search tree and bidirectional linked list 37 Serialize binary tree 38 Arrangement of strings 39 Numbers that appear more than half of the tim

vulnhub之Funfox2

CSDN语法说明

Some important knowledge of MySQL

2022如何评估与选择低代码开发平台?

国家网信办公布《数据出境安全评估办法》:累计向境外提供10万人信息需申报

openEuler 资源利用率提升之道 01:概论

Detailed explanation of Flink parallelism and slot

How to cooperate among multiple threads

The project manager's "eight interview questions" is equal to a meeting
随机推荐
2022年投资哪个理财产品收益高?
8 CAS
How to buy stocks on your mobile phone and open an account? Is it safe to open an account
MSE API学习
How to cooperate among multiple threads
力扣 1961. 检查字符串是否为数组前缀
mysql 的一些重要知识
PMP每日一练 | 考试不迷路-7.7
Classification automatique des cellules de modules photovoltaïques par défaut dans les images de lecture électronique - notes de lecture de thèse
开源重器!九章云极DataCanvas公司YLearn因果学习开源项目即将发布!
vulnhub之school 1
R language dplyr package mutate_ At function and min_ The rank function calculates the sorting sequence number value and ranking value of the specified data column in the dataframe, and assigns the ra
【剑指offer】剑指 Offer II 012. 左右两边子数组的和相等
R语言ggplot2可视化:使用ggpubr包的ggqqplot函数可视化QQ图(Quantile-Quantile plot)
Training IX basic configuration of network services
R language ggplot2 visualization: use the ggqqplot function of ggpubr package to visualize the QQ graph (Quantitative quantitative plot)
Mysql, sqlserver Oracle database connection mode
Browse the purpose of point setting
LeetCode_ 7_ five
My creation anniversary