Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

there is a problem about "Two Sum" #18

Open
Gdreamlend opened this issue Apr 15, 2014 · 5 comments
Open

there is a problem about "Two Sum" #18

Gdreamlend opened this issue Apr 15, 2014 · 5 comments

Comments

@Gdreamlend
Copy link

In a case the code is not right: if gap == num[i] then you will get result[0]=result[1]

@soulmachine
Copy link
Owner

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?

@Gdreamlend
Copy link
Author

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//issues/18#issuecomment-40581311
.

@soulmachine
Copy link
Owner

I tested this case, the output of my code is 2, 3, which is correct.

@Gdreamlend
Copy link
Author

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//issues/18#issuecomment-40690242
.

@lmscsomg
Copy link

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]):)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants