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.
Nice way to code.
cool but unreadable
ahhhhhhhhhh excellent
I believe the
i
inint i = 0
should be declared as along
instead. Ifn
is actually a long value,i
will overflow. An alternative would be to use a while loop and decrementn
.You're right, although String.repeat() was only added since Java 11 and won't work on java 8...
This is indeed the best practice if you have a "long" parameter. If on the other hand the type parameter was an "int", then it would be safe to use string.repeat(n) as the answer.