当前位置:网站首页>力扣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)
边栏推荐
- Training IX basic configuration of network services
- AD域组策略管理
- Browse the purpose of point setting
- ant desgin 多选
- torch. nn. functional. Pad (input, pad, mode= 'constant', value=none) record
- R language uses ggplot2 function to visualize the histogram distribution of counting target variables that need to build Poisson regression model, and analyzes the feasibility of building Poisson regr
- Notes...
- Make this crmeb single merchant wechat mall system popular, so easy to use!
- 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
- R语言dplyr包select函数、group_by函数、filter函数和do函数获取dataframe中指定因子变量中指定水平中特定数值数据列的值第三大的值
猜你喜欢
RESTAPI 版本控制策略【eolink 翻译】
PMP practice once a day | don't get lost in the exam -7.7
PMP对工作有益吗?怎么选择靠谱平台让备考更省心省力!!!
Detailed explanation of Flink parallelism and slot
ASP. Net kindergarten chain management system source code
Cloud component development and upgrading
Interpretation of transpose convolution theory (input-output size analysis)
Welcome to the markdown editor
Flink并行度和Slot详解
Dynamic addition of El upload upload component; El upload dynamically uploads files; El upload distinguishes which component uploads the file.
随机推荐
R language uses ggplot2 function to visualize the histogram distribution of counting target variables that need to build Poisson regression model, and analyzes the feasibility of building Poisson regr
【STL】vector
R语言fpc包的dbscan函数对数据进行密度聚类分析、查看所有样本的聚类标签、table函数计算聚类簇标签与实际标签构成的二维列联表
AD域组策略管理
Chapter 9 Yunji datacanvas was rated as 36 krypton "the hard core technology enterprise most concerned by investors"
Compiler optimization (4): inductive variables
力扣 459. 重复的子字符串
转置卷积理论解释(输入输出大小分析)
项目经理『面试八问』,看了等于会了
Equals method
A pot of stew, a collection of common commands of NPM and yarn cnpm
Training IX basic configuration of network services
干货分享|DevExpress v22.1原版帮助文档下载集合
pom. Brief introduction of XML configuration file label function
UCloud是基础云计算服务提供商
CSDN语法说明
Sword finger offer II 013 Sum of two-dimensional submatrix
Specify the version of OpenCV non-standard installation
Open source heavy ware! Chapter 9 the open source project of ylarn causal learning of Yunji datacanvas company will be released soon!
[sword finger offer] sword finger offer II 012 The sum of left and right subarrays is equal