HTMLify

LeetCode - Max Consecutive Ones - Python
Views: 1 | Author: abh
class Solution:
    def findMaxConsecutiveOnes(self, nums: List[int]) -> int:
        m = 0
        cc = 0
        for n in nums:
            if n != 1:
                cc = 0
                continue
            cc += 1
            if cc > m:
                m = cc
        return m

Comments