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.
This comment is hidden because it contains spoiler information about the solution
Your solution uses imprecise operations which cause problems for large numbers. It is not a kata issue, your solution has a (small) bug. The "concise" approach is good, you just need to fix the precision issue.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Okay, so I have come up with multiple solutions which supposed to be mathematically correct, but test cases still fail.
None of them are brut-force - all tests completes in 2.5 ms - still the numbers are off.
Couple times by factors of 2, so some overflow error I guess. According to docs Python shouldn't have overflow errors as integers have no hard limit.
I will add my code in answers so I don't have to
spoiler
the whole thing (: