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.
Awesome fu here, thanks. Especially fusing the array traversals and the shift.
It's a bit cryptic though, always the same problem :).
This comment is hidden because it contains spoiler information about the solution
Hi! I wonder if
rustc
optimizes the two traversals into a single traversal? Does anybody know?This is one of the best katas I have ever completed! Thanks!
Updated the solution.
Man, I just destroyed two hours of work on another kata in a glimpse. It all started when I forgot my mouse at work. When I was working on the kata, I had to use my laptops' touchpad, which I am not used to at all. Then suddenly, I must have done a finger gesture which made my browser turn back the page - and all was lost. Now I cry like a baby....!
This comment is hidden because it contains spoiler information about the solution
Thank you for reporting the problem! I think I fixed all issues. Sorry for the inconvenience!
I took your solution as complete working solution.
For Rust, when clicking "Attempt", this kata only compiles when the import statement
use std::str::FromStr;
is added. At first, I did not useFromStr
and passed the "Test" step, but could not run "Attempt". Further, the visible tests have the expected solution on the LEFT while the hidden tests have the expected solution on the RIGHT. This confused me during debugging.You may have commented another version of this solution, but I do not see how primes are recomputed. First, the upper bound is computed, then all primes until the upper bound.
I have a Factor translation pending which tries out a new method of testing. I do two tests:
x
And if both are passed then the test case is considered passed. This can become somewhat finicky as certain expressions can result in all kinds of invalid, or rediculously large values, but with care I think that it could be the best way to test this kind of kata.
Would it be unreasonable to just expect the unchanged order of the input for this case? Should the kata be changed ( some simplifications are already explicitly not expected ), or should the description just be expanded?
Is this a language-specific suggestion, or do you want this to apply to all languages?
Nice solution, thanks!
That should also work. A rule could be that literals should always be on the left hand side (if the operator is commutative).
I agree. I also get:
And so on.
I really enjoyed this kata in the beginning, but with all these corner cases, it became a bit of a hazzle. Nice idea though, thank you!
Loading more items...