Skip to content

Commit d2eed30

Browse files
committed
Solved leetcode 485
1 parent b908387 commit d2eed30

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

485/485.py

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
class Solution:
2+
def findMaxConsecutiveOnes(self, nums: List[int]) -> int:
3+
maxConsec = 0
4+
currConsec = 0
5+
for num in nums:
6+
if(num):
7+
currConsec += 1
8+
else:
9+
maxConsec = max(maxConsec, currConsec)
10+
currConsec = 0
11+
12+
return max(maxConsec, currConsec)
13+
14+

0 commit comments

Comments
 (0)