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

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

PMP对工作有益吗?怎么选择靠谱平台让备考更省心省力!!!

谷歌seo外链Backlinks研究工具推荐

多个线程之间如何协同

9 atomic operation class 18 Rohan enhancement

Implement secondary index with Gaussian redis
让这个 CRMEB 单商户微信商城系统火起来,太好用了!

Le PGR est - il utile au travail? Comment choisir une plate - forme fiable pour économiser le cœur et la main - d'œuvre lors de la préparation de l'examen!!!

vulnhub之school 1

Chapter 9 Yunji datacanvas was rated as 36 krypton "the hard core technology enterprise most concerned by investors"
随机推荐
Training IX basic configuration of network services
网信办公布《数据出境安全评估办法》,9 月 1 日起施行
PMP对工作有益吗?怎么选择靠谱平台让备考更省心省力!!!
LeetCode力扣(剑指offer 36-39)36. 二叉搜索树与双向链表37. 序列化二叉树38. 字符串的排列39. 数组中出现次数超过一半的数字
The project manager's "eight interview questions" is equal to a meeting
Ways to improve the utilization of openeuler resources 01: Introduction
力扣 643. 子数组最大平均数 I
UCloud是基础云计算服务提供商
MySQL、sqlserver oracle数据库连接方式
The strength index of specialized and new software development enterprises was released, and Kirin Xin'an was honored on the list
位运算介绍
841. String hash
# 欢迎使用Markdown编辑器
【STL】vector
力扣 459. 重复的子字符串
openEuler 资源利用率提升之道 01:概论
力扣 2315.统计星号
力扣 1961. 检查字符串是否为数组前缀
Ucloud is a basic cloud computing service provider
Some important knowledge of MySQL