我擦,我也做到简单题了Hhhhhhhhhhh,又是美好的一天
class Solution:
def findMaxConsecutiveOnes(self, nums: List[int]) -> int:
n=len(nums)
mx=0
set=0
for num in nums:
if num==1:
set+=1
if set>mx:
mx=set
if num==0:
set=0
return mx