Skip to content

Commit

Permalink
Time: 312 ms (33.71%), Space: 13.9 MB (35.42%) - LeetHub
Browse files Browse the repository at this point in the history
  • Loading branch information
ComputerScientist-01 committed Aug 4, 2021
1 parent b5bbbef commit 1ebb7e7
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions max-consecutive-ones/max-consecutive-ones.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
class Solution(object):
def findMaxConsecutiveOnes(self, nums):
count = int(0)
result = int(0)
n=len(nums)
for i in range (n):
if (nums[i]==0):
count=0
else:
count-=-1
result=max(count,result)
return result


"""
:type nums: List[int]
:rtype: int
"""

0 comments on commit 1ebb7e7

Please sign in to comment.