当前位置:网站首页>力扣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)
边栏推荐
- Notes...
- LC:字符串转换整数 (atoi) + 外观数列 + 最长公共前缀
- 多个线程之间如何协同
- Kirin Xin'an joins Ningxia commercial cipher Association
- Ways to improve the utilization of openeuler resources 01: Introduction
- Kirin Xin'an cloud platform is newly upgraded!
- R语言dplyr包select函数、group_by函数、filter函数和do函数获取dataframe中指定因子变量中指定水平中特定数值数据列的值第三大的值
- Sword finger offer II 013 Sum of two-dimensional submatrix
- Visual Studio 插件之CodeMaid自动整理代码
- The strength index of specialized and new software development enterprises was released, and Kirin Xin'an was honored on the list
猜你喜欢
LeetCode力扣(剑指offer 36-39)36. 二叉搜索树与双向链表37. 序列化二叉树38. 字符串的排列39. 数组中出现次数超过一半的数字
8 CAS
How to cooperate among multiple threads
YoloV6:YoloV6+Win10---训练自己得数据集
8 CAS
Navicat连接2002 - Can‘t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock‘解决
谷歌seo外链Backlinks研究工具推荐
干货分享|DevExpress v22.1原版帮助文档下载集合
Make insurance more "safe"! Kirin Xin'an one cloud multi-core cloud desktop won the bid of China Life Insurance, helping the innovation and development of financial and insurance information technolog
RESTAPI 版本控制策略【eolink 翻译】
随机推荐
Kirin Xin'an with heterogeneous integration cloud financial information and innovation solutions appeared at the 15th Hunan Financial Technology Exchange Conference
Open source heavy ware! Chapter 9 the open source project of ylarn causal learning of Yunji datacanvas company will be released soon!
[RT thread env tool installation]
torch. nn. functional. Pad (input, pad, mode= 'constant', value=none) record
强化学习-学习笔记8 | Q-learning
el-upload上传组件的动态添加;el-upload动态上传文件;el-upload区分文件是哪个组件上传的。
ant desgin 多选
LeetCode_ 7_ five
The project manager's "eight interview questions" is equal to a meeting
R语言ggplot2可视化:使用ggpubr包的ggdensity函数可视化分组密度图、使用stat_overlay_normal_density函数为每个分组的密度图叠加正太分布曲线
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
怎么在手机上买股票开户 股票开户安全吗
Is PMP beneficial to work? How to choose a reliable platform to make it easier to prepare for the exam!!!
Redis——基本使用(key、String、List、Set 、Zset 、Hash、Geo、Bitmap、Hyperloglog、事务 )
Semantic SLAM源码解析
R语言ggplot2可视化:使用ggpubr包的ggecdf函数可视化分组经验累积密度分布函数曲线、linetype参数指定不同分组曲线的线型
力扣 643. 子数组最大平均数 I
R语言fpc包的dbscan函数对数据进行密度聚类分析、查看所有样本的聚类标签、table函数计算聚类簇标签与实际标签构成的二维列联表
剑指 Offer II 013. 二维子矩阵的和
谷歌seo外链Backlinks研究工具推荐