neetcode-gh/leetcode

Bug Report for duplicate-integer

Closed this issue · 1 comments

Bug Report for https://neetcode.io/problems/duplicate-integer

Please describe the bug below and include any steps to reproduce the bug or screenshots if possible.

I have done this same code in IDE (visual studio code), i got correct answer .

answer = None
for i in nums:
if nums.count(i) == 1:
answer = True
else:
answer = False
break

return answer

Thanks for feedback! You just need to interchange the lines answer = True and answer = False because you need to return True if nums has duplicate values and it is checked by the else block.