/*水题*/ class Solution { public: int removeDuplicates(int A[], int n) { int temp = A[0],j = 0; for(int i = 0 ; i < n ;){ while(i<n&&A[i] == temp) i++; A[j++] = temp; temp = A[i]; } return j; } };
/*水题*/ class Solution { public: int removeDuplicates(int A[], int n) { int temp = A[0],j = 0; for(int i = 0 ; i < n ;){ while(i<n&&A[i] == temp) i++; A[j++] = temp; temp = A[i]; } return j; } };