标签:lcis incr return longest col int lob elf ret
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
标签:lcis incr return longest col int lob elf ret
原文地址:https://www.cnblogs.com/whatyouthink/p/13296616.html