[LeetCode] Remove Element (Python)
2024. 2. 27. 11:03ㆍ자료구조
class Solution:
def removeElement(self, nums: List[int], val: int) -> int:
i = 0
for j in range(len(nums)):
if nums[j] != val:
nums[i] = nums[j]
i += 1
return i
'자료구조' 카테고리의 다른 글
[LeetCode] Check If N and Its Double Exist (Python) (0) | 2024.02.29 |
---|---|
[LeetCode] Remove Duplicates from Sorted Array (Python) (0) | 2024.02.27 |
[LeetCode] Merge Sorted Array (Python) (0) | 2024.02.27 |
[LeetCode] Duplicate Zeros (Python) (0) | 2024.02.27 |
[LeetCode] Squares of a Sorted Array (Python) (0) | 2024.02.27 |