/**
 * @param {number[]} nums
 * @return {number}
 */
var removeDuplicates = function(nums) {
   for(let i=0; i<nums.length - 1; i++) {
    if(nums[i] === nums[i+1]) {
        nums.splice(i+1, 1);
        i--;
    }
    
   }

   return nums.length;
};

// 2 pointers, one pointing at start and another at one ahead of start. 
// if both pointer values match, remove the second one and reduce the loop iterator once to - 
// account for any duplicates appearing more that once