This is my python solution


  • 0
    D

    """
    def findMaxConsecutiveOnes(self, nums):

        count = 0
        temp = []
        for i in nums:
            if i == 1:
                count += 1
            else:
                temp.append(count)
                count = 0
        temp.append(count)
        return max(temp)
    

    """
    Runtime is 79 ms


Log in to reply
 

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