题目:给定一个数组,要求去除数组中所有重复数字(仅保留一位)
算法:如下
public class Solution {
    public int removeDuplicates(int[] A) {
	    	int length = 0;
	    	for (int i=0; i<A.length; ++i) {
	    		if (0==length || A[i]!=A[length-1]) {
	    			A[length++] = A[i];
	    		}
	    	}
	    	return length;
	    }
}[LeetCode]Remove Duplicates from Sorted Array,布布扣,bubuko.com
[LeetCode]Remove Duplicates from Sorted Array
原文地址:http://blog.csdn.net/yeweiouyang/article/details/37534567