1. 题目
2. 分析
3. 代码
class Solution:def removeDuplicates(self, nums: List[int]) -> int:if len(nums) < 3:return len(nums)i = 0j = 1k = 2while(k < len(nums)):if (nums[i] == nums[j]):while(k < len(nums) and nums[j] == nums[k] ):k+=1if (k < len(nums)):j+=1 i+=1nums[j] = nums[k]k+=1 else:j+=1i+=1nums[j] = nums[k]k+=1return j+1