Longest Continuous Increasing Subsequence

Problem Id: 674 Difficulty: Easy


Intuition

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