python solution: 7 lines O(n)


  • 0
    H
    class Solution(object):
        def removeDuplicates(self, nums):
            if len(nums)<=1:
                return;
            for i in range(len(nums)-1,0,-1):
                if nums[i]==nums[i-1]:
                    del nums[i-1]
    

Log in to reply
 

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