[LeetCode] Duplicate Zeros (Python)
2024. 2. 27. 10:41ㆍ자료구조
class Solution:
def duplicateZeros(self, arr: List[int]) -> None:
temp = []
for i in range(len(arr)):
if arr[i] == 0:
temp.append(arr[i])
temp.append(arr[i])
answer = temp[:len(arr)]
for i in range(len(arr)):
arr[i] = answer[i]
'자료구조' 카테고리의 다른 글
[LeetCode] Remove Element (Python) (0) | 2024.02.27 |
---|---|
[LeetCode] Merge Sorted Array (Python) (0) | 2024.02.27 |
[LeetCode] Squares of a Sorted Array (Python) (0) | 2024.02.27 |
[LeetCode] Find Numbers with Even Number of Digits (Python) (0) | 2024.02.27 |
[LeetCode] Max Consecutive Ones (Python) (0) | 2024.02.27 |