题目:
题解:
func removeElement(nums []int, val int) int {
left, right := 0, len(nums)
for left < right {
if nums[left] == val {
nums[left] = nums[right-1]
right--
} else {
left++
}
}
return left
}