485. Max Consecutive Ones

来源:互联网 发布:淘宝追加评论不显示 编辑:程序博客网 时间:2024/06/05 21:21
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
0 0