674. Longest Continuous Increasing Subsequence

Information

  • Diffculty: Easy

  • Created: 2019-09-09 21:57:26

  • Last Motified: 2019-09-09 21:57:26

Solution

class Solution:
    def findLengthOfLCIS(self, nums: List[int]) -> int:
        if not nums:
            return 0
        longest = 1
        last = nums[0]
        length = 1
        for i in range(1, len(nums)):
            if nums[i] > last:
                length += 1
            else:
                length = 1
            longest = max(length, longest)
            last = nums[i]
        return longest