leetcode icon indicating copy to clipboard operation
leetcode copied to clipboard

Bug Report for remove-duplicates-from-sorted-array in Go

Open jordanglean opened this issue 11 months ago • 0 comments

Bug Report for https://neetcode.io/problems/remove-duplicates-from-sorted-array

Used the solution in the video but in Go:

func removeDuplicates(nums []int) int {
   l := 1

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

   }

   return l
}

When I submit, It keeps failing this test case: Passed test cases: 23 / 24

jordanglean avatar Dec 20 '25 13:12 jordanglean