mirror of
https://github.com/autistic-symposium/master-algorithms-py.git
synced 2025-05-22 16:31:15 -04:00
Update array-duplicate-zeros.py
This commit is contained in:
parent
896aaaf88f
commit
153b111e09
1 changed files with 5 additions and 1 deletions
|
@ -1,3 +1,7 @@
|
|||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
# author: bt3gl
|
||||
|
||||
# Given a fixed-length integer array arr, duplicate each occurrence of zero,
|
||||
# shifting the remaining elements to the right.
|
||||
|
||||
|
@ -30,4 +34,4 @@ def duplicate_zeros(arr: list[int]) -> list[int]:
|
|||
if __name__ == "__main__":
|
||||
|
||||
arr = [1, 0, 2, 3, 0, 4, 5, 0]
|
||||
print(duplicate_zeros(arr))
|
||||
print(duplicate_zeros(arr))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue