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

Find a bug in searchInsertPosition.cpp #7

Closed
pezy opened this issue Oct 25, 2014 · 1 comment
Closed

Find a bug in searchInsertPosition.cpp #7

pezy opened this issue Oct 25, 2014 · 1 comment

Comments

@pezy
Copy link

pezy commented Oct 25, 2014

Have a look at: https://github.com/haoel/leetcode/blob/master/src/searchInsertPosition/searchInsertPosition.cpp#L28

int mid = low +(high-low)/2;

would occur overflow. try to change to this:

int mid = (high-low)/2;
@pezy
Copy link
Author

pezy commented Oct 25, 2014

Sorry, My mistake.

@pezy pezy closed this as completed Oct 25, 2014
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

1 participant