```
class Solution(object):
def removeDuplicates(self, nums):
if nums == []: return 0
left = 0
for i in range(1,len(nums)):
if nums[i] != nums[left]:
if left + 1 < i:
nums[left+1] = nums[i]
left += 1
del nums[left+1:]
return len(nums)
```

Look forward to suggestions to remove more duplicated steps. Thanks.