x = 0 while len(nums) - 1 >= x + 1: if nums[x] == nums[x + 1]: del nums[x + 1] else: x += 1 return len(nums)
i = 1 while(len(nums) > i): if(nums[i-1] == nums[i]): del nums[i] else: i += 1 return i
Hi, it seems that my code are same with you, but it doesn't work. it always notice that index out of range, could you help me out here?
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.