Bug Report for https://neetcode.io/problems/two-integer-sum-ii
Please describe the bug below and include any steps to reproduce the bug or screenshots if possible.
class Solution:
def twoSum(self, numbers: List[int], target: int) -> List[int]:
for i in range(len(numbers)):
num2 = target - numbers[i]
if num2 in numbers:
return [i + 1, numbers.index(num2) + 1]
This solution though doesn't work if we have duplicate numbers in the List; but in the Neetcode it passed all the test cases, I tried the same solution in the Leetcode but there it fails that particular test case.
The above attached solution is from the Neetcode where it clears all the test case and got accepted.
The above attached solution is from the Leetcode where it doesn't clear all the test case.
Bug Report for https://neetcode.io/problems/two-integer-sum-ii
Please describe the bug below and include any steps to reproduce the bug or screenshots if possible.
class Solution:
def twoSum(self, numbers: List[int], target: int) -> List[int]:
for i in range(len(numbers)):
num2 = target - numbers[i]
if num2 in numbers:
return [i + 1, numbers.index(num2) + 1]
This solution though doesn't work if we have duplicate numbers in the List; but in the Neetcode it passed all the test cases, I tried the same solution in the Leetcode but there it fails that particular test case.
The above attached solution is from the Neetcode where it clears all the test case and got accepted.
The above attached solution is from the Leetcode where it doesn't clear all the test case.