leetcode Remove Duplicates from Sorted Array python

class Solution(object):
    def removeDuplicates(self,nums):
    if len(nums) <= 0:
        return 0
    
    j=0
    for i in range(0,len(nums)):
        if nums[i] != nums[j]:
        print 'i j is ',i,j
        nums[i],nums[j+1] = nums[j+1],nums[i]
        j=j+1
    return j+1

 

posted @ 2015-11-29 18:06  hao.ma  阅读(133)  评论(0编辑  收藏  举报