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.
Ok, thanks for clarification
This Kata uses a very ridiculous optimization technique. Let's just say, the Kata really wants you to optimize the fact that only up to exactly a million elements will tested. It's overkill if you ask. Your algorithm is likely correct, but try to aggressively optimize everything other than your algorithm too.
I think there is a problem with this kata. I prepared a solution and tested it on my local machine + js sandbox. My solution returns the variable "result" which is integer. When I make an attemp - it works slowly and as a result i caught timeout error. My solution is correct(there is no proble with it), it is executed vast everywhere except codewars. Moreover, I get the right answer during my code execution. The problem is in the output. If I convert my answer to string(for instance) - I get an error that MY ANSWER IS WRONG BECAUSE OF THE TYPE MISSMATH, but I see that the result of my calculation is right and mathces the final answer of this kata(the same situation happens when I convert the "result" variable to object). Could you please take a look at this point? If it is needed, I can post my solution in this chat