removeDuplicates2 = function(nums) {
    const isEdgeCase = (nums.length < 2)
    if (isEdgeCase) return nums.length;

    let [ left, right ] = [ 2, 2 ];

    while (right < nums.length) {/* Time O(N) */
        const isEqual = (nums[(left - 2)] === nums[right]);
        if (!isEqual) {
            nums[left] = nums[right];
            left += 1;
        }

        right += 1;
    }
    return left;
}
Two pointer
Time O(n^2) | Space O(1)
@param {number[]} nums
@return {number}