class Solution:
def findMaxConsecutiveOnes(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
nums.append(0)
count = 0
max_count = 0
for i in nums:
if i == 1:
count += 1
elif i == 0:
if max_count < count:
max_count = count
count = 0
return max_count
No comments:
Post a Comment