Given an integer array nums and an integer val, remove all occurrences of val in nums in-place. The relative order of the elements may be changed.
func removeElement(nums []int, val int) int {
left := 0
for _, v := range nums { // v 即 nums[right]
if v != val {
nums[left] = v
left++
}
}
return left
}