标签:重复 list dup class 排序数组 span elf turn sel
class Solution: def removeDuplicates(self, nums: List[int]) -> int: if not nums: return 0 count = 0 for i in range(len(nums)): if nums[count] != nums[i]: count += 1 nums[count]= nums[i] # count从0开始的,如果nums中只有一个数,如果不+1,返回的是0,错误 return count+1
标签:重复 list dup class 排序数组 span elf turn sel
原文地址:https://www.cnblogs.com/WJZheng/p/11384523.html