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

Incorrest result for vector of 1 element #1

Closed
vladon opened this issue Nov 7, 2015 · 9 comments
Closed

Incorrest result for vector of 1 element #1

vladon opened this issue Nov 7, 2015 · 9 comments

Comments

@vladon
Copy link

@vladon vladon commented Nov 7, 2015

Pass vector of 1 element (for example, { 0 }) to your function. It will return -1, but must return 0.

@mrrusof
Copy link
Owner

@mrrusof mrrusof commented Nov 8, 2015

What is "your function" ?

@mrrusof
Copy link
Owner

@mrrusof mrrusof commented Nov 9, 2015

You are right. Please review commit e6817b3. I claim that if condition == 0, then A.size() < 2.

@vladon
Copy link
Author

@vladon vladon commented Nov 9, 2015

@mrrusof Now it's incorrect for { 0, 0 } :-) Must return 0, but returns 1.

@mrrusof
Copy link
Owner

@mrrusof mrrusof commented Nov 9, 2015

@vladon Nice. What about now? 6a362df

@vladon
Copy link
Author

@vladon vladon commented Nov 9, 2015

@mrrusof Sorry again, now it returns 0 for {0, 1}, but must return 1

For {0, 1, 0} it returns 0, but must return 2...

@mrrusof
Copy link
Owner

@mrrusof mrrusof commented Feb 14, 2016

hmmm. What about now? 51c5adb

@mrrusof
Copy link
Owner

@mrrusof mrrusof commented Apr 24, 2016

@vladon I think I fixed it. Could you please have a look?

@vladon vladon closed this Apr 25, 2016
@mrrusof
Copy link
Owner

@mrrusof mrrusof commented Apr 25, 2016

Thank you!

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

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.