Simple and concise python code


  • 0
    R
    class Solution(object):
        def findMaxConsecutiveOnes(self, array):
            """
            :type nums: List[int]
            :rtype: int
            """
            arrayString = "".join(map(str, array))
            arrayString = arrayString.split("0")
            maxv = 0
            for i in range(len(arrayString)):
                maxv = max(len((arrayString[i])), maxv)
            return maxv
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.