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.
Just trying to avoid the timeout by avoiding redundant calculations across many tests.
Ok, this was fun (as always a little bit sobering to see the better solutions..), though strangely, so few people attempt this one. I think it might be a good idea to give a little more introductory info on the game rules like:
"(Mega)Connect4 is played on a vertical, rectangular board. The players tokens drop in a column and stack on top of each other. The win condition is met when the token of the current move connects N-1 other tokens of the same kind in a vertical or horizontal line or a line parallel to the boards diagonals."
This comment is hidden because it contains spoiler information about the solution
The cache will save over time because you only run the first line of code just once, after that all the test are using by calling the function with different numbers.
Using the dict CACHE helps u jump over test you have already done in the previous so it s faster.
Chances are thinked the same way he did but by not using cache you are wasting time on useless tests.
"if number not in CACHE:" is always evaluated as true. So why use CACHE at all? I don't get it.