---
description: '#双指针'
---

# leetcode26.删除有序数组中的重复项

[26 删除重复数组的重复项](https://leetcode.cn/problems/remove-duplicates-from-sorted-array/description/)



```golang
func removeDuplicates(nums []int) int {

    l,r:=0,0

    for r<len(nums){
        if nums[l]!=nums[r]{
            l++
            nums[l]=nums[r]
        }
        r++
    }

    return l+1

}
```

