Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
I don't see any 'good' or 'bad' practices here.
Please, correct me if I'm wrong.
For me, this question is rather a matter of taste. Because at the end of the day you end with the same instructions, the only difference is the structure of the code.
Hence there are no other differences the choice must be based on readability. And as for me, for-loop is more readable due to its conciseness.
still no answer, some kind of magic... :)
right, there is also "getOrDefault" method - may be worth to consider.
I was worried the Garbage Collector might get bored if it had nothing to do.
This comment is hidden because it contains spoiler information about the solution
Also computationally inefficient, because each time an element gets evaluated, it is compared with all the existing lists. But I loved the functional approach.
You're right, although String.repeat() was only added since Java 11 and won't work on java 8...
This comment is hidden because it contains spoiler information about the solution
i agree a while loop might be more readable here, thanks
It depends on how you approach the problem. I've found the Streams in Java to be great for declarative-style programming. I don't have to keep track of a "sum" or "min" variable, or even an "i" counter for the for loop. I just declare the function I want and it's all processed for me by the stream. While it maybe runs slower, such micro-optimizations are outweighed by readability. "Easier to understand" is in the eye of the team working on the code.
Appreciate the feedback!
Maybe he can't see the picture?
see the picture - the balls don't sit exactly on top of each other. For 3 layers the height is a little bit less than 3 diameters
EDIT:
see the pictureVisuallize a rack of pool/snooker balls stacked in a triangle - the balls don't sit exactly on top of each other. For 3 layers the height of that triangle is a little bit less than 3 diametersvisualize how they would be stacked
i love you my man! <3