当前位置:网站首页>力扣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)
边栏推荐
猜你喜欢

AD域组策略管理

关于ssh登录时卡顿30s左右的问题调试处理

论文解读(ValidUtil)《Rethinking the Setting of Semi-supervised Learning on Graphs》

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

The project manager's "eight interview questions" is equal to a meeting

Is PMP beneficial to work? How to choose a reliable platform to make it easier to prepare for the exam!!!

8 CAS

华南X99平台打鸡血教程

【STL】vector

vulnhub之Funfox2
随机推荐
Ucloud is a basic cloud computing service provider
实训九 网络服务的基本配置
转置卷积理论解释(输入输出大小分析)
Kirin Xin'an with heterogeneous integration cloud financial information and innovation solutions appeared at the 15th Hunan Financial Technology Exchange Conference
Make this crmeb single merchant wechat mall system popular, so easy to use!
PMP对工作有益吗?怎么选择靠谱平台让备考更省心省力!!!
Is PMP beneficial to work? How to choose a reliable platform to make it easier to prepare for the exam!!!
What does "true" mean
R语言ggplot2可视化:使用ggpubr包的ggdensity函数可视化分组密度图、使用stat_overlay_normal_density函数为每个分组的密度图叠加正太分布曲线
UCloud是基础云计算服务提供商
Introduction to bit operation
R语言ggplot2可视化:使用ggpubr包的ggviolin函数可视化小提琴图、设置palette参数自定义不同水平小提琴图的填充色、add参数在小提琴图添加箱图
Navicat连接2002 - Can‘t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock‘解决
ASP. Net kindergarten chain management system source code
力扣 2315.统计星号
线性基
Kirin Xin'an joins Ningxia commercial cipher Association
The state cyberspace Office released the measures for data exit security assessment: 100000 information provided overseas needs to be declared
位运算介绍
力扣 643. 子数组最大平均数 I