```
class Solution(object):
def removeDuplicates(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
new = list(set(nums))
new.sort()
nums[0:len(new)] = new
return len(new)
```

**104ms**

comparing with 100ms solution below

```
class Solution(object):
def removeDuplicates(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
if len(nums) == 0: return 0
i = 0
for x in nums:
if (nums[i] != x):
i += 1
nums[i] = x
return i + 1
```