Neat Python


  • 0
    X
    class Solution(object):
        def removeDuplicates(self, nums):
            """
            :type nums: List[int]
            :rtype: int
            """
            if nums == []: return 0
            curP = 0
            for i in xrange(len(nums)):
                if nums[i] > nums[curP]:
                    curP+=1
                    nums[curP] = nums[i]
            return curP+1
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.