728x90
https://leetcode.com/problems/duplicate-zeros/
class Solution:
def duplicateZeros(self, arr: List[int]) -> None:
in_arr = arr.copy()
in_len = len(in_arr)
arr.clear()
for i in in_arr:
if len(arr) == in_len:
break
arr.append(i)
if len(arr) == in_len:
break
if i == 0:
arr.append(0)
728x90
'IT > 코딩테스트' 카테고리의 다른 글
[Leetcode] 1051. Height Checker (0) | 2023.09.02 |
---|---|
[Leetcode] 88. Merge Sorted Array (1) | 2023.09.02 |
[Leetcode] 577. Employee Bonus (0) | 2023.09.01 |
[Leetcode] 197. Rising Temperature (0) | 2023.08.31 |
[Leetcode] 1581. Customer Who Visited but Did Not Make Any Transactions (0) | 2023.08.30 |