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.
Note on recursion is IMO not necessary. I think it's your task to know when recursion is a good tool, and when it's not. If you decide to use it, you should already know (or find out) if it's applicable to your problem, in your language, etc.
Recursion, just like every other tool, has its advantages and disadvantages. Here, the latter outweigh the former. You just picked the wrong tool for the job.
This comment is hidden because it contains spoiler information about the solution
So, can we somehow mark this solution as "NOT OK" so not to confuse anyone?