int removeDuplicates(int A[], int n) //Remove Duplicates from Sorted Array
{
if (n == 0) return 0;
int index = 0;
for (int i = 1; i < n; i++) {
if (A[index] != A[i])
A[++index] = A[i];
}
return index + 1;
}LeetCode之Remove Duplicates from Sorted Array,布布扣,bubuko.com
LeetCode之Remove Duplicates from Sorted Array
原文:http://blog.csdn.net/daydayyup/article/details/23712699