Skip to content

SecondLargestElement Algorithm returns wrong value #1035

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

Closed
Ankush263 opened this issue Jun 3, 2022 · 3 comments · Fixed by #1036
Closed

SecondLargestElement Algorithm returns wrong value #1035

Ankush263 opened this issue Jun 3, 2022 · 3 comments · Fixed by #1036
Labels
bug Something isn't working

Comments

@Ankush263
Copy link
Contributor

for the array [-1, -2, -3, -4] it returns 0

@appgurueu appgurueu added the bug Something isn't working label Jun 3, 2022
@appgurueu appgurueu changed the title fix SecondLargestElement Algorithm SecondLargestElement Algorithm returns wrong value Jun 3, 2022
@appgurueu
Copy link
Collaborator

I assume the algorithm just wasn't intended to support negative values as it uses 0 as a default min value.

@Ankush263
Copy link
Contributor Author

Should I make a PR

@appgurueu
Copy link
Collaborator

Should I make a PR

I've already fixed it, see the linked PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants