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.
There shouldn't be an issue with timeout on this one unless you're overcomplicating the algorithm. I heavily leveraged loops in my solution but still made it with time to spare.
Perhaps change your approach. It might help to look up, mathematically, how to solve a problem like this.
If you have the right approach, you won't need to optimize your algorithm.
Might have been an infinite loop issue. Not sure though.
Just a heads up, this solution is entirely dependent on server execution time (the main issue with this kata). If servers are moving slow, this solution fails to complete in time. If servers are moving at a normal pace, this works.
Look man, I enjoyed solving this problem. What I didn't enjoy was spending an hour optimizing it just so that it could be submitted.
Good idea, bad execution. Thank you for the problem though, it was initially fun to solve.
(edit): after completing the kata, I looked at the solutions for JS. The most common successful solution in JS will fail based on server speed roughly half the time.