yeah sorry lol i was just experimenting with javadoc comments
edit: also the description was kinda a joke it referenced "this" cuz i removed the this keywords it wasnt about anything else
You got a point here. The aspect we often not intuitively think about, but we should care with high standards.
Often voted best practices are not very explanatory at all. I have a lot to learn too. At the end of the day that's the reason why we are here. Share knowledge. I appreciate your commitment.
Overall your solution is nice and solid. The comments are obsolete and clutter your code. Use comments only in places where code cannot explain itself. Streams are a fancy way to make things more readable (in most cases) and shorten code. Kind regards Simon
What will happen in if
n
is 0?It is a nearly perfect solution.
You can be a bit concise by using the reduce method instead, because it uses the first value which is identical here.
yeah sorry lol i was just experimenting with javadoc comments
edit: also the description was kinda a joke it referenced "this" cuz i removed the this keywords it wasnt about anything else
Btw, I have made the variable names and method names clear to avoid adding comments.
You got a point here. The aspect we often not intuitively think about, but we should care with high standards.
Often voted best practices are not very explanatory at all. I have a lot to learn too. At the end of the day that's the reason why we are here. Share knowledge. I appreciate your commitment.
sort may not be better all the time. Go for readability and maintainability.
Overall your solution is nice and solid. The comments are obsolete and clutter your code. Use comments only in places where code cannot explain itself. Streams are a fancy way to make things more readable (in most cases) and shorten code. Kind regards Simon