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.
Your goal is not to make your code shorter, but faster.
Your code being too slow is not a kata issue. Please read the posts below.
Execution Timed Out (16000 ms)
I don't know what to do to make this code shorter, I'm desperate
I have three loops (for), 1 nested in another to calculate s(n), and a separate loop(for) to calculate z(s(n)). Is there any formula to fit everything into 1 loop(for)...?
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.
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 (:Kinda crap. Test cases so cumbersome that the only way to solve the problem is to look for the explicit formula. No coding skill required.
the code turned out very interesting
yeah I totally agree
Approved with a new reference solution.
that's pretty fast by the standards of the universe
Translate Dart
check my solution
It depends, if the kata is bumped up by a recent description edit or language update, translating it would reduce the time of waiting as it is more likely that someone will chime in and review it, but consider yourself lucky if it's within few months or so ^^
how long does it take to check a translation of a kata?
Dart translate
Loading more items...