public class Solution {
public int removeDuplicates(int[] nums) {
if(nums.length==0||nums.length==1) return nums.length;
int count=1;
for(int i=1;i<nums.length;i++){
if(nums[i-1]!=nums[i]) nums[count++]=nums[i];
}
return count;
}
}
网友评论