-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Open
Description
Bug Report for https://neetcode.io/problems/remove-duplicates-from-sorted-array
Please describe the bug below and include any steps to reproduce the bug or screenshots if possible.
My golang solution is an exact match for the python solution yet it fails when submitting.
Python solution listed on site:
def removeDuplicates(self, nums: list[int]) -> int:
n = len(nums)
l = r = 0
while r < n:
nums[l] = nums[r]
while r < n and nums[r] == nums[l]:
r += 1
l += 1
return lThe solution I came up with in Go:
func removeDuplicates(nums []int) int {
l, r := 0, 0
for r < len(nums) {
nums[l] = nums[r]
for r < len(nums) && nums[r] == nums[l] {
r++
}
l++
}
return l
}Test case that is failing is 24 of 24. All other 23 passed.
If this is the best you guys can do I honestly expect a refund.
Metadata
Metadata
Assignees
Labels
No labels