class Solution(object): def removeDuplicates(self, nums): """ :type nums: List[int] :rtype: int """ for i in range(len(nums)): for j in range(i+1,len(nums)): if nums[i] == nums[i+1]: del nums[i+1] else: break return len(nums)
2024-03-18 14:24:10
class Solution(object): def removeDuplicates(self, nums): """ :type nums: List[int] :rtype: int """ for i in range(len(nums)): for j in range(i+1,len(nums)): if nums[i] == nums[i+1]: del nums[i+1] else: break return len(nums)