Update 0027.移除元素.md

添加0027.移除元素 go版本
This commit is contained in:
X-shuffle
2021-05-12 15:44:55 +08:00
committed by GitHub
parent 04bb63da12
commit 08781d4ceb

View File

@ -129,7 +129,19 @@ Python
Go Go
```go
func removeElement(nums []int, val int) int {
length:=len(nums)
res:=0
for i:=0;i<length;i++{
if nums[i]!=val {
nums[res]=nums[i]
res++
}
}
return res
}
```
JavaScript: JavaScript:
``` ```