int removeDuplicates(int A[], int n) {
        if(n <= 1)
        return n;
        int newIndex = 0;
        for(int i = 1; i < n; ++i){
            if(A[i] != A[newIndex])
            A[++newIndex] = A[i];
        }
        return ++newIndex; 
    }【leetcode】Remove Duplicates from Sorted Array,布布扣,bubuko.com
【leetcode】Remove Duplicates from Sorted Array
原文地址:http://blog.csdn.net/shiquxinkong/article/details/29693601