485. Max Consecutive Ones

xiaoxiao2021-02-27  975

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
转载请注明原文地址: https://www.6miu.com/read-157.html

最新回复(0)