将列表中重复的数据放在后面,返回列表中元素去除重复后的个数:
def deduplication(nums):
# write your code here
exist_nums ={}
pointer =0
for num in nums:
if num notin exist_nums:
exist_nums[num]=True
nums[pointer]= num
pointer +=1
return pointer
print(deduplication([1,1,1,1,1,1,2,2,2,2,2,2,2,2]))