-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Open
Description
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.
Take this test case into consideration which is NOT included during submission:
nums=[3,4,3,6]
target=9
the above test case fails
but on submission all tests passed
with this algorithm:
vector twoSum(vector& v, int target) {
vector<vector> vec;
unordered_map<int,int> m;
for (int i=0; i<v.size(); ++i) {
if (m.find(target-v[i])!=m.end()) {
vec.push_back({m[target-v[i]],i});
}
m[v[i]]=i;
}
sort(vec.begin(),vec.end());
return vec[0];
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels