暴力解法就不写了
以下是双指针写法
var removeDuplicates = function(nums) {
let slow = 0;
for(let i = 1;i < nums.length;){
if(nums[i] != nums[slow]){
slow++;
nums[slow] = nums[i];
}
i++;
}
return slow
};