Easy Python Solution


  • 0
    A
    class Solution(object):
        def findMaxConsecutiveOnes(self, nums):
            """
            :type nums: List[int]
            :rtype: int
            """
            for i in range(len(nums))[:len(nums)-1]:
                if nums[i]!=0 and nums[i+1]!=0: nums[i+1]=nums[i]+1
            return max(nums)
    
    

Log in to reply
 

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