[LeetCode] 26. Remove Duplicates from Sorted Array
Python
class Solution:
def removeDuplicates(self, nums: List[int]) -> int:
before = 0
for current in range(1, len(nums)):
if nums[current] != nums[before]:
before += 1
nums[before] = nums[current]
return before + 1
댓글남기기