首页
Java
登录
6mi
u
盘
搜
搜 索
Java
Max Consecutive Ones
Max Consecutive Ones
xiaoxiao
2021-02-27
186
找出1的最大连续个数
class Solution(object):
def findMaxConsecutiveOnes(self, nums): """ :type nums: List[int] :rtype: int """ res=0 step=0 for i in nums: if i==1: step+=1 res=max(res,step) else: step=0 return res
转载请注明原文地址: https://www.6miu.com/read-12545.html
技术
最新回复
(
0
)