class Solution(object):
def findMaxConsecutiveOnes(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
count = result = 0
for i in nums:
if i == 1:
count += 1
else:
result = max(result, count)
count = 0
return max(result, count)
70-Array--LC485最大连续1的个数
最新推荐文章于 2024-08-17 20:25:49 发布