leetcode485 python3 88ms 最大连续1的个数
class Solution:
def findMaxConsecutiveOnes(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
res = 0
curr = 0
for i in nums:
if i != 0:
curr += 1
else:
res = max(res, curr)
curr = 0
res = max(res, curr)
return res