当前位置:网站首页>力扣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)
边栏推荐
- 力扣 459. 重复的子字符串
- R language ggplot2 visualization: use the ggstripchart function of ggpubr package to visualize the dot strip plot, set the position parameter, and configure the separation degree of different grouped
- 编译器优化那些事儿(4):归纳变量
- Compiler optimization (4): inductive variables
- 841. String hash
- R语言ggplot2可视化:使用ggpubr包的ggqqplot函数可视化QQ图(Quantile-Quantile plot)
- Training IX basic configuration of network services
- Visual Studio 插件之CodeMaid自动整理代码
- 一锅乱炖,npm、yarn cnpm常用命令合集
- Navicat连接2002 - Can‘t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock‘解决
猜你喜欢

CSDN syntax description

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

九章云极DataCanvas公司摘获「第五届数字金融创新大赛」最高荣誉!

Introduction to bit operation

The state cyberspace Office released the measures for data exit security assessment: 100000 information provided overseas needs to be declared
![最多可以参加的会议数目[贪心 + 优先队列]](/img/f3/e8e939e0393efc404cc159d7d33364.png)
最多可以参加的会议数目[贪心 + 优先队列]

LeetCode_ 7_ five

Some important knowledge of MySQL

多个线程之间如何协同

LeetCode力扣(剑指offer 36-39)36. 二叉搜索树与双向链表37. 序列化二叉树38. 字符串的排列39. 数组中出现次数超过一半的数字
随机推荐
mock.js从对象数组中任选数据返回一个数组
【剑指offer】剑指 Offer II 012. 左右两边子数组的和相等
PMP对工作有益吗?怎么选择靠谱平台让备考更省心省力!!!
AD域组策略管理
JVM GC垃圾回收简述
How to buy bank financial products? Do you need a bank card?
Introduction to bit operation
Some arrangements about oneself
九章云极DataCanvas公司获评36氪「最受投资人关注的硬核科技企业」
# 欢迎使用Markdown编辑器
9 原子操作类之18罗汉增强
Openeuler prize catching activities, to participate in?
Detailed explanation of Flink parallelism and slot
小试牛刀之NunJucks模板引擎
Implement secondary index with Gaussian redis
Semantic slam source code analysis
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
ASP. Net kindergarten chain management system source code
How to cooperate among multiple threads
Cloud component development and upgrading