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.
There's one simple reason why this piece of code mustn't considered to be good practice:
method valueOf() returns Integer wrapper type (NOT int) and, under the hood, unnecessary unboxing happens.
Agree
No point in a
class
with 1 effectively static method.Random tests shouldn't generate non-positive numbers.
Then it should probably be just a function, why the extra noise?
I mean,
assertEquals("", Solution().repeatStr(-10, "kata"))
doesn't look like a valid case.THe descrition is just like the original. Changed!
No, any reason at all
Any reason why the function is not package-level or in the companion object?
There's nothing about the negative count in the description.
Recursive. Nice and easy!
Really clever!
Thanks for the comment, really usefull
Es lo que tiene que las expresiones regulares no te parezcan magia negra