本文共 362 字,大约阅读时间需要 1 分钟。
class Solution(object): def findMaxConsecutiveOnes(self, nums): """ :type nums: List[int] :rtype: int """ max_count = 0 count = 0 for num in nums: if num == 1: count += 1 max_count = max(max_count,count) else: count = 0 return max_count
转载地址:http://sjnmd.baihongyu.com/