Open tsungtingdu opened 3 years ago
var removeDuplicates = function(nums) {
let pointer1 = 2
for (let pointer2 = 2; pointer2 < nums.length; pointer2++) {
if (nums[pointer1 - 2] !== nums[pointer2]) {
nums[pointer1] = nums[pointer2]
pointer1++
}
}
return pointer1
};