Leetcode26-删除有序数组中的重复项 思路:双指针i, j i用来记录哪些项是不重复的,j来遍历所有项。 class Solution: def removeDuplicates(self, nums: List[int]) -> int: i = 0 j = 1 #for j in range(1, len(nums)): while j < len(nums): if nums[j] != nums[i]: nums[i+1] = nums[j] i += 1 else: j += 1 return i+1