Question: http://oj.leetcode.com/problems/remove-duplicates-from-sorted-array/
Question Name: Remove Duplicates from Sorted Array
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | class Solution: # @param a list of integers # @return an integer def removeDuplicates(self, A): # Handle the special case that, A is empty if len(A) == 0: return 0 front, back = 1, 1 while front < len(A): if A[front] != A[front-1]: # Not a duplicate item A[back] = A[front] back += 1 front += 1 return back |