Remove Duplicates from Sorted Array
题意:将有序array中的重复元素删除
解法:还是看代码吧。
public class Solution127 {
public int removeDuplicates(int[] A) {
if (A.length==0){
return 0;
}
int size=1;
for (int i=1;i<A.length;i++){
if (A[i]!=A[i-1]){
A[size]=A[i];
size++;
}
}
return size;
}
}