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.
See my fork for a simple, clear, non-recursive solution to this, using a bit of abuse of default input to shorten the solution. I prefer that a lot over putting
if/else
statements on a single line though.You can always just turn recursion limits off too (which also works here on codewars!)
Yeah I agree if it were to be used in the real world it would probably be better and safer to do it iteratively and do some checks so it doesn't run forever. For these small kata I find it more fun to solve them in short and interesting ways though :)