题目:
题解:
python
class Solution:
def findMaxConsecutiveOnes(self, nums: List[int]) -> int:
maxCount = count = 0
for i, num in enumerate(nums):
if num == 1:
count += 1
else:
maxCount = max(maxCount, count)
count = 0
maxCount = max(maxCount, count)
return maxCount