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.
Many thanks for the tips myjinxin. I will try again.
I've tranlaste my JS solution to Ruby, complete all tests in 4000ms.
So your code needs to improve the algorithms.
Because of I'm not completely understand your code, a possible suggestion to you:
Don't calculate the sum in each step, only calculate it at the end.
Using a $prefill array outside the function to store some results can save your time too ;-)
This comment is hidden because it contains spoiler information about the solution
Could you mark up that code with line breaks?
(See Documentations -> Codewars Platform -> Comment Markdown, and click through from there.)
This comment is hidden because it contains spoiler information about the solution
Wow