# 解题思路: 无 20190302 找工作期间
class Solution(object):
def removeDuplicates(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
k = 0
if not nums:
return None
for i in range(1,len(nums)):
if nums[i] != nums[k]:
k += 1
nums[k] = nums[i]
return k+1
class Solution2(object):
def removeDuplicates(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
k = 0
if not nums:
return None
for i in range(1,len(nums)):
if nums[i] != nums[k]:
k += 1
nums[k],nums[i] = nums[i],nums[k]
return k+1
nums = [0,0,1,1,1,2,2,3,3,4]
s = Solution2()
print(s.removeDuplicates(nums))
print nums