def removeDuplicates(self, A): if len(A)==0 or len(A)==1: return len(A) i=1 j=1 while i<len(A): if A[i]!=A[i-1]: A[j]=A[i] j=j+1 i=i+1 A[j:]= return j
Output: del, pop(), or remove() are not allowed.
I did not use del/pop/remove. I just use A[j: ] to shrink the list. Any one knows what's the problem?
You are not allowed to shrink the list. Instead you return the size of the list after duplicate items are "removed".
See here if you are still confused what to return.