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 get the joke...
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This code returns string either way I guess :D
could someone explain the concept behind this
JS update fork
hyper brainy
mine respect
This comment is hidden because it contains spoiler information about the solution
It is unclear what the failure message means when a test failed:
What it's probably trying to say is using
0
and1
at indexi
to mark whetheri+1
can be represented by the ruler, but then again, this is not informative test feedback.There are no sample tests or random tests.
my brain isn't braining
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.My function finish it in 50ms but on codewars i can't run tests , it's saying that the function times out. Can't because the code is fast with no infinite loops
Hi @eiphorie - in random tests, the value of
n
goes up to10**19
or so meaning that actually creating the string is impossible, let alone counting inside it.You have to find a smarter way to get the answer - for this, you can use your solution for smaller values of
n
to maybe try to find some patterns or help you debug.This is actually more of a mathematics/logic type kata, so if you don't get the answer straight away then practicing on other katas will definitely improve your ability to "see" the correct approach and techniques. Hope that helps a bit
This comment is hidden because it contains spoiler information about the solution
Loading more items...