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.
I don't use JavaScript so I can't see your current solution, but if you are going through all numbers up to
n
and counting9
inside each one, it will be too slow (even with just this "simple loop" rather than an "infinite loop").Maybe the 50ms timing is for very small tests you have tried? Like with
n = 100
or something? In the full kata tests the inputn
goes to10**19
- try your function with this value on your PC tests if you want to see how fast it is.It is still unsoluble,...
You're awesome to be able to focus on that, but the sense of accomplishment that comes with a solution is unparalleled.
I don;t think there's too many test inputs. In Javascript, there's 100 random tests, and each can have numbers up to 100 digits long. My JavaScript solution passes the tests in ~1 second. I think tests are balanced quite well, you just need better algorithm.
Feel free to join Codewars Discord, you could get some help in the
#help-solve
channel!What needs to be fixed is your code because it's not efficient enough. There is no bug in the kata.
Note that a code being short or easy to read has nothing to do with it being efficient or not.