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.
Recurssion and iteration don't scale well. Factorial calculation with big numbers is a problem. The idea for this kata is to find a method that reduces the number of iterations/recursive calls to the minimum necessary to find a solution. You need a little bit of math before implementing a solution.
There are other solutions without using a recursive implementation.
This comment is hidden because it contains spoiler information about the solution
Yes, I would like it if you do.
I've updated the tests and added some comments here and there. Hope it helps.
Please, let me know if you find anything else.
This is actually the same as this:
I should have seen this, and also that
3 * Math.ceil(n / 3) + (n - 1) % 3
is the same asn + 2
I had replied before, but it looks like my reply was not posted.
Anyway. Thanks for your comments. I have improved this kata a little bit. I now use
797651
in my tests.Let me know if you have any other improvement.
This comment is hidden because it contains spoiler information about the solution
What should I return when input is null or empty string?