当前位置:网站首页>力扣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)
边栏推荐
- 国家网信办公布《数据出境安全评估办法》:累计向境外提供10万人信息需申报
- LeetCode_7_5
- 8 CAS
- Throughput
- The strength index of specialized and new software development enterprises was released, and Kirin Xin'an was honored on the list
- Dynamic addition of El upload upload component; El upload dynamically uploads files; El upload distinguishes which component uploads the file.
- LeetCode力扣(剑指offer 36-39)36. 二叉搜索树与双向链表37. 序列化二叉树38. 字符串的排列39. 数组中出现次数超过一半的数字
- R language ggplot2 visualization: use the ggviolin function of ggpubr package to visualize the violin diagram, set the palette parameter to customize the filling color of violin diagrams at different
- Cloud component development and upgrading
- torch. nn. functional. Pad (input, pad, mode= 'constant', value=none) record
猜你喜欢

ASP.NET幼儿园连锁管理系统源码

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

LeetCode力扣(剑指offer 36-39)36. 二叉搜索树与双向链表37. 序列化二叉树38. 字符串的排列39. 数组中出现次数超过一半的数字

vulnhub之school 1

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

8 CAS

Interpretation of transpose convolution theory (input-output size analysis)

Chapter 9 Yunji datacanvas was rated as 36 krypton "the hard core technology enterprise most concerned by investors"

RESTAPI 版本控制策略【eolink 翻译】

Kunpeng developer summit 2022 | Kirin Xin'an and Kunpeng jointly build a new ecosystem of computing industry
随机推荐
The strength index of specialized and new software development enterprises was released, and Kirin Xin'an was honored on the list
pom.xml 配置文件标签:dependencies 和 dependencyManagement 区别
银行理财产品怎么买?需要办银行卡吗?
PMP对工作有益吗?怎么选择靠谱平台让备考更省心省力!!!
[RT thread env tool installation]
Notes...
最多可以参加的会议数目[贪心 + 优先队列]
vulnhub之school 1
ant desgin 多选
mock.js从对象数组中任选数据返回一个数组
Specify the version of OpenCV non-standard installation
开源OA开发平台:合同管理使用手册
Sword finger offer II 013 Sum of two-dimensional submatrix
凌云出海记 | 赛盒&华为云:共助跨境电商行业可持续发展
Mysql, sqlserver Oracle database connection mode
ASP. Net gymnasium integrated member management system source code, free sharing
Version selection of boot and cloud
使用高斯Redis实现二级索引
吞吐量Throughout
线性基