mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-09 02:53:31 +08:00
Update 0027.移除元素.md
添加0027.移除元素 go版本
This commit is contained in:
@ -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:
|
||||||
```
|
```
|
||||||
|
Reference in New Issue
Block a user