HTMLify
LeetCode - Max Consecutive Ones - Python
Views: 341 | Author: abh
1 2 3 4 5 6 7 8 9 10 11 12 | 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 |