It is kind of two pointers, but in a concise way

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