标签:blog io ar for 2014 c on log r
class Solution { public: int removeDuplicates(int A[], int n) { int duplicate = 0; int i = 0; for(i = 0; i < n - 1; i++){ if(A[i] == A[i + 1]){ duplicate++; } else { A[i - duplicate + 1] = A[i + 1]; } } return n - duplicate; } };
Remove Duplicates from Sorted Array
标签:blog io ar for 2014 c on log r
原文地址:http://blog.csdn.net/wyj7260/article/details/39805575