Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save luojiyin1987/b86f408ff5716ebcca2dd9251b871cf7 to your computer and use it in GitHub Desktop.
Save luojiyin1987/b86f408ff5716ebcca2dd9251b871cf7 to your computer and use it in GitHub Desktop.
Longest Continuous Increasing Subsequence
class Solution(object):
def findLengthOfLCIS(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
nums_length = len(nums)
if nums_length <=1:
return nums_length
max_length = 0
count = 1
lastNum = nums[0]
for num in nums[1:]:
if num > lastNum:
count +=1
else:
count = 1
lastNum = num
if count > max_length:
max_length = count
return max_length
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment