i points to the last unique element, j iterates through the array
i := 0 for j := 1; j < len(nums); j++ { if nums[j] != nums[i] { i++ nums[i] = nums[j] } }