Open Gdreamlend opened 10 years ago
I couldn't understand your question, I just tested my code, and my code can pass the "Two Sum" on LeetCode.
Could you be more specific about your question?
my question is :if the test list is {3,2,4} and target is 6, your code would not be accepted
2014-04-16 17:46 GMT+08:00 Frank Dai notifications@github.com:
I couldn't understand your question, I just tested my code, and my code can pass the "Two Sum" on LeetCode.
Could you be more specific about your question?
— Reply to this email directly or view it on GitHubhttps://github.com/soulmachine/leetcode/issues/18#issuecomment-40581311 .
I tested this case, the output of my code is 2, 3
, which is correct.
I will try it again latter ,thanks for your reply.
2014-04-17 15:59 GMT+08:00 Frank Dai notifications@github.com:
I tested this case, the output of my code is 2, 3, which is correct.
— Reply to this email directly or view it on GitHubhttps://github.com/soulmachine/leetcode/issues/18#issuecomment-40690242 .
I met the same problem, I think maybe you can change the codeif(mapping.find(gap) !=mapping.end())
into if(mapping.find(gap)!=mapping.end() && i!=mapping[gap])
:)
In a case the code is not right: if gap == num[i] then you will get result[0]=result[1]