MCPcopy Create free account
hub / github.com/HuberTRoy/leetCode / Solution

Class Solution

DP/LongestContinuousIncreasingSubsequence.py:24–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22今日的零启动算法。
23"""
24class Solution(object):
25 def findLengthOfLCIS(self, nums):
26 """
27 :type nums: List[int]
28 :rtype: int
29 """
30 if not nums:
31 return 0
32
33 dp = [1]
34
35 for i in range(1, len(nums)):
36 if nums[i] > nums[i-1]:
37 dp.append(dp[i-1]+1)
38 else:
39 dp.append(1)
40 return max(dp)
41
42

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected