-
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
I have come up with a solution the consistently works in pycharm locally. I can confirm I am using the same versions of python on neetcode as well as pyCharm:
class Solution:
def removeDuplicates(self, nums: List[int]) -> int:
numdict = {}
for num in nums:
if num not in numdict:
numdict[num] = 1
else:
numdict[num] += 1
nums = list(numdict.keys())
return len(nums)



My output on leetcode reads: [1,1,2,3], [2,10,10] for case 1 and 2.
Either nums is not getting modified or there is a problem in the dictionary implementation. My solution may not be the most optimal but I feel surely there is a problem here.
Metadata
Metadata
Assignees
Labels
No labels