index_iterate = range(len(nums)-1)
index_iterate = index_iterate[::-1]
for index in index_iterate: # Check if the prev. element has same value as this if nums[index+1] == nums[index]: del nums[index+1] return len(nums)
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.