26. Remove Duplicates from Sorted Array
https://leetcode.com/problems/remove-duplicates-from-sorted-array
Python
class Solution:
def removeDuplicates(self, nums: List[int]) -> int:
if length := len(nums) < 2:
return length
cur, after = 0, 1
while after < len(nums):
if nums[cur] != nums[after]:
cur += 1
nums[cur], nums[after] = nums[after], nums[cur]
after += 1
return cur + 1