class Solution:
def findMaxConsecutiveOnes(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
s = ""
for i in nums:
s += str(i)
m = max([len(j) for j in s.split("0")])
return m
leetcode - 485 - 最大连续1的个数
最新推荐文章于 2025-03-24 00:45:00 发布
本文介绍了一种算法,用于找出由1组成的最长连续子串的长度。通过将整数列表转换为字符串,然后分割该字符串以找到最长的'1'序列,从而实现了这一目标。
1741

被折叠的 条评论
为什么被折叠?



