Bug Report for two-integer-sum
Bug Report for https://neetcode.io/problems/two-integer-sum
Please describe the bug below and include any steps to reproduce the bug or screenshots if possible.
In the Two Integer Sum problem, the statement says: “Return the answer with the smaller index first.”
However, this constraint is not being enforced in the test cases:
For example:
nums = [2, 2, 7, 15] target = 9
The valid answer is: [0, 2] → nums[0] + nums[2] = 9, but this test case is not included, and the already present test cases are not enforcing this constraint.
Suggested Fix
Either:
Add a test case such as nums = [2, 2, 7, 15], target = 9 and clarify/enforce which valid pair is expected,. or
Change the constraint to match the original LeetCode statement:
“You can return the answer in any order.”
This would avoid ambiguity when multiple valid pairs exist. Thank you.
Source: neetcode-gh/leetcode