Skip to content

Add Solution 035[CPP] #61

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

Merged
merged 2 commits into from
Oct 26, 2018
Merged

Add Solution 035[CPP] #61

merged 2 commits into from
Oct 26, 2018

Conversation

KongJHong
Copy link
Contributor

None.

if(nums[left] == target)return left;
if(nums[right] == target)return right;

int mid = (left + right) / 2;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mid = (left + right) / 2 这个写法并不好,可能发生溢出而导致程序错误。
最好写成 mid = left + ((right - left) >> 1) 噢~

@yanglbme yanglbme merged commit 62cb50b into doocs:master Oct 26, 2018
@KongJHong
Copy link
Contributor Author

KongJHong commented Oct 26, 2018 via email

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

Successfully merging this pull request may close these issues.

2 participants