674. Longest Continuous Increasing Subsequence

Posted whatyouthink

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了674. Longest Continuous Increasing Subsequence相关的知识,希望对你有一定的参考价值。

Given an unsorted array of integers, find the length of longest continuous increasing subsequence (subarray).

找最长连续上升子序列

class Solution(object):
    def findLengthOfLCIS(self, nums):
        """
        :type nums: List[int]
        :rtype: int
        """
        n = len(nums)
        global_max = 1 if n > 0 else 0
        current_max = 1
        for i in range(1, len(nums), 1):
            if nums[i] > nums[i - 1]:
                current_max += 1
                global_max = max(global_max, current_max)
            else:
                current_max = 1
        return global_max
            
            

 

以上是关于674. Longest Continuous Increasing Subsequence的主要内容,如果未能解决你的问题,请参考以下文章

674. Longest Continuous Increasing Subsequence

674. Longest Continuous Increasing Subsequence@python

674. Longest Continuous Increasing Subsequence

674. Longest Continuous Increasing Subsequence

674. Longest Continuous Increasing Subsequence

[LC] 674. Longest Continuous Increasing Subsequence