```
public int removeDuplicates(int[] nums) {
if(nums.length <= 1) return nums.length;
int ret = 1;
int num = nums[0];
for(int i = 1; i < nums.length; i++) {
if(nums[i] != num) {
num = nums[i];
ret ++;
}
}
return ret;
}
```

can't pass:

Input:[1,1,2]

Output:[1,1]

Expected:[1,2]

but,is this case's Output:2,Expected:2