Skip to content

Commit

Permalink
Time: 43 ms (61.16%), Space: 11.9 MB (68.01%) - LeetHub
Browse files Browse the repository at this point in the history
  • Loading branch information
hovanhoa committed Apr 10, 2024
1 parent 584e027 commit a44ac2c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions 1089-duplicate-zeros/1089-duplicate-zeros.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
class Solution(object):
def duplicateZeros(self, arr):
"""
:type arr: List[int]
:rtype: None Do not return anything, modify arr in-place instead.
"""
i = 0
while i < len(arr):
if arr[i] == 0:
arr.insert(i+1, 0)
arr.pop()
i += 1
i += 1
return arr

0 comments on commit a44ac2c

Please sign in to comment.