File tree 2 files changed +15
-1
lines changed
2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change 128
128
| 475 | [ Heaters] ( https://leetcode.com/problems/heaters ) | Medium | [ ![ Java] ( https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png )] ( src/Heaters.java ) [ ![ Python] ( https://img.icons8.com/color/35/000000/python.png )] ( python/heaters.py ) |
129
129
| 476 | [ Number Complement] ( https://leetcode.com/problems/number-complement ) | Easy | [ ![ Java] ( https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png )] ( src/NumberComplement.java ) [ ![ Python] ( https://img.icons8.com/color/35/000000/python.png )] ( python/number_complement.py ) |
130
130
| 482 | [ License Key Formatting] ( https://leetcode.com/problems/license-key-formatting ) | Easy | [ ![ Java] ( https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png )] ( src/LicenseKeyFormatting.java ) [ ![ Python] ( https://img.icons8.com/color/35/000000/python.png )] ( python/license_key_formatting.py ) |
131
- | 485 | [ Max Consecutive Ones] ( https://leetcode.com/problems/max-consecutive-ones ) | Easy | [ ![ Java] ( https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png )] ( src/MaxConsecutiveOnes.java ) |
131
+ | 485 | [ Max Consecutive Ones] ( https://leetcode.com/problems/max-consecutive-ones ) | Easy | [ ![ Java] ( https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png )] ( src/MaxConsecutiveOnes.java ) [ ![ Python ] ( https://img.icons8.com/color/35/000000/python.png )] ( python/max_consecutive_ones.py ) |
132
132
| 492 | [ Construct the Rectangle] ( https://leetcode.com/problems/construct-the-rectangle ) | Easy | [ ![ Java] ( https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png )] ( src/ConstructTheRectangle.java ) [ ![ Python] ( https://img.icons8.com/color/35/000000/python.png )] ( python/construct_the_rectangle.py ) |
133
133
| 496 | [ Next Greater Element I] ( https://leetcode.com/problems/next-greater-element-i ) | Easy | [ ![ Java] ( https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png )] ( src/NextGreaterElementI.java ) [ ![ Python] ( https://img.icons8.com/color/35/000000/python.png )] ( python/next_greater_element_i.py ) |
134
134
| 500 | [ Keyboard Row] ( https://leetcode.com/problems/keyboard-row ) | Easy | [ ![ Java] ( https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png )] ( src/KeyBoardRow.java ) [ ![ Python] ( https://img.icons8.com/color/35/000000/python.png )] ( python/keyboard_row.py ) |
Original file line number Diff line number Diff line change
1
+ from typing import List
2
+
3
+
4
+ class Solution :
5
+ def findMaxConsecutiveOnes (self , nums : List [int ]) -> int :
6
+ max_ones , current = 0 , 0
7
+ for number in nums :
8
+ if number == 1 :
9
+ current += 1
10
+ else :
11
+ max_ones = max (max_ones , current )
12
+ current = 0
13
+ max_ones = max (max_ones , current )
14
+ return max_ones
You can’t perform that action at this time.
0 commit comments