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.
Same here.
Its more of a mathmatical question rather than complex algrithoms
The problem you are facing is your nested loops. For small numbers like 100 they will work fine but if you get a number like 100000 then it will have to loop through 100000 number 100000 times which is doable but takes a very long time.
If it takes longer than the codewars server allows for execution time then it will timeout.
You need to find another method of running a check that uses less or no nested loops (the optimisation lies in the algebra before the code).
This comment is hidden because it contains spoiler information about the solution
My solution is not very optimized but works. And I cannot validate this Kata because Execution Timed Out (12000 ms).