File tree 2 files changed +18
-2
lines changed
2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change 84
84
| 268 | [ Missing Number] ( https://leetcode.com/problems/missing-number ) | Easy | [ ![ Java] ( https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png )] ( src/MissingNumber.java ) [ ![ Python] ( https://img.icons8.com/color/35/000000/python.png )] ( python/missing_number.py ) |
85
85
| 270 | 🔒 [ Closest Binary Search Tree Value] ( https://leetcode.com/problems/closest-binary-search-tree-value ) | Easy | |
86
86
| 276 | 🔒 [ Paint Fence] ( https://leetcode.com/problems/paint-fence ) | Easy | |
87
- | 278 | [ First Bad Version] ( https://leetcode.com/problems/first-bad-version ) | Easy | [ ![ Java] ( https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png )] ( src/FirstBadVersion.java ) [ ![ Python] ( https://img.icons8.com/color/35/000000/python.png )] ( python/first_bad_version.py ) |
88
- | 283 | [ Move Zeroes] ( https://leetcode.com/problems/move-zeroes ) | Easy | [ ![ Java] ( https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png )] ( src/MoveZeros.java ) |
87
+ | 278 | [ First Bad Version] ( https://leetcode.com/problems/first-bad-version ) | Easy | [ ![ Java] ( https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png )] ( src/FirstBadVersion.java ) [ ![ Python] ( https://img.icons8.com/color/35/000000/python.png )] ( python/first_bad_version.py ) |
88
+ | 283 | [ Move Zeroes] ( https://leetcode.com/problems/move-zeroes ) | Easy | [ ![ Java] ( https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png )] ( src/MoveZeros.java ) [ ![ Python ] ( https://img.icons8.com/color/35/000000/python.png )] ( python/move_zeroes.py ) |
89
89
| 290 | [ Word Pattern] ( https://leetcode.com/problems/word-pattern ) | Easy | [ ![ Java] ( https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png )] ( https://github.com/anishLearnsToCode/leetcode-algorithms/blob/master/src/WordPattern.java ) |
90
90
| 292 | [ Nim Game] ( https://leetcode.com/problems/nim-game ) | Easy | [ ![ Java] ( https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png )] ( https://github.com/anishLearnsToCode/leetcode-algorithms/blob/master/src/NimGame.java ) |
91
91
| 293 | [ Flip Game] ( https://leetcode.com/problems/flip-game ) | Easy | |
Original file line number Diff line number Diff line change
1
+ from typing import List
2
+
3
+
4
+ class Solution :
5
+ def moveZeroes (self , nums : List [int ]) -> None :
6
+ if len (nums ) == 1 :
7
+ return
8
+ i , j = 0 , 1
9
+ while True :
10
+ while i < len (nums ) and nums [i ] != 0 :
11
+ i += 1
12
+ while j < len (nums ) and (nums [j ] == 0 or j < i ):
13
+ j += 1
14
+ if i >= len (nums ) or j >= len (nums ):
15
+ break
16
+ nums [i ], nums [j ] = nums [j ], 0
You can’t perform that action at this time.
0 commit comments