-
Notifications
You must be signed in to change notification settings - Fork 20k
Add SecondMinMax
#4432
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
Add SecondMinMax
#4432
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BharathSanjeeviT thanks for an interesting contribution. Before we will marge it, I have some remarks.
Please add some proper tests. Good examples to look at:
Factorial
andFactorialTest
,FindMax
andFindMaxTest
.
Hey @vil02 , Thank you for looking into my contribution and suggesting all the changes. Hope I did correct all those you said 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hope I did solved all the change that you have addressed 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic in findSecondMin
and findSecondMax
is very similar (basically the type of inequality). Do you see some way to remove duplicated code?
By the way, you can commit suggestions directly just by clicking the Commit suggestion
button - this automatically resolves the conversation.
Hey @vil02 , made the changes that you have mentioned and btw i thought Commit Changes would add extra commits, thanks for the information 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made all these changes 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for a monster suggestion: sometimes it is easier to express ideas just by writing code.
c0521c4
to
ebe3c02
Compare
Hey @vil02 , made the changes that you've suggested 👍 |
The changes you say, actually making me to learn new things, so i should thank you 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is really close!
a7ee1d2
to
07d23aa
Compare
Hey @vil02 , the changes you have suggested are made, hope you merge this PR 👍 |
Each variable declaration must be in its own statement.
SecondMinMax
@BharathSanjeeviT thanks for your contribution! |
Hey @vil02 , Thank you soo much, i loved this process of contributing towards The Algorithms 👍 |
Description
This PR provides a feature that contains the Java Program to find second largest / smallest element from the array with the most optimal solution
This PR addresses the Issue #4430
I have read code of conduct and provided this PR accordingly