Simple python code


  • 0
    S

    def findMaxConsecutiveOnes(self, nums):
    """
    :type nums: List[int]
    :rtype: int
    """
    temp = 0
    res = 0
    for i in range(len(nums)):
    temp += nums[i]
    res= max(temp,res)
    if nums[i]== 0:
    temp =0
    return res


Log in to reply
 

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