[LeetCode]Remove Duplicates from Sorted Array

题目:给定一个数组,要求去除数组中全部反复数字(仅保留一位)

算法:例如以下

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;
	    }
}

原文地址:https://www.cnblogs.com/mfrbuaa/p/4481555.html