[LeetCode-Eazy] Remove Element
Using Golang To Solve This Problem.
Golang
func removeElement(nums []int, val int) int {
r := 0
for k,v := range nums {
if nums[k] != val {
nums[r] = v
r++
}
}
return r
}
和這題很類似 概念都是一樣的