https://leetcode-cn.com/explore/interview/card/top-interview-questions-easy/1/array/21/
请大家用go解决一下这个问题。
```golang
func removeDuplicates(nums []int) int {
p:=0
ct:=0
idx:=0
for i,v:=range nums {
if i==0 {
p = v
ct = ct + 1
idx = idx + 1
continue
}
if v!=p {
nums[idx]=v
ct = ct +1
p = v
idx = idx + 1
}
}
return ct
}
```
#1
更多评论