Skip to content
LC-0674 Easy LeetCode

674. Longest Continuous Increasing Subsequence

Read the full problem statement on LeetCode.
Difficulty: easy Acceptance: 51% Topics: Array
View full problem on LeetCode

Reading material

Reference solution (spoiler · python)
# Time:  O(n)
# Space: O(1)

class Solution(object):
    def findLengthOfLCIS(self, nums):
        """
        :type nums: List[int]
        :rtype: int
        """
        result, count = 0, 0
        for i in xrange(len(nums)):
            if i == 0 or nums[i-1] < nums[i]:
                count += 1
                result = max(result, count)
            else:
                count = 1
        return result

Solution from kamyu104/LeetCode-Solutions · MIT