class Solution:
def duplicateZeros(self, arr: List[int]) -> None:
"""
Do not return anything, modify arr in-place instead.
"""
result_list = []
for i in range(len(arr)):
print(arr[i])
if arr[i] == 0:
result_list.append(arr[i])
result_list.append(arr[i])
result = result_list[:len(arr)]
for x in range(len(result)):
arr[x] = result[x]
'알고리즘 > 배열(array)' 카테고리의 다른 글
Remove Duplicates from Sorted Array python (0) | 2023.06.29 |
---|---|
Merge Sorted Array python (0) | 2023.06.26 |
Squares of a Sorted Array (0) | 2023.06.26 |
Find Numbers with Even Number of Digits python (0) | 2023.06.26 |
Max Consecutive Ones python (0) | 2023.06.26 |