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.
The test cases in Rust pass incorrect data types...
Forgot to mention that a workaround is to change, in your implementation, the type of the second parameter in
count_patternsto u8. Hopefully your code can take it :), the practice tests will fail, but your code will run on the submission tests.
Did you solve this? I reckon you don't need to go all the way up to searchNum, but rather figure out what's the smallest shape a k-prime can have, when expanded, that's as much as you need to loop. No more.
Wow this one did a trick on me, I was testing
puzzlewith parameters up to 6 orders of magnitude.
Understandbly, it was pretty slow and hard to optimize such a thing, and ended up writting pretty ugly code, and although it passed, I kept getting timeout.
I am quite new to code wars so I did not realize that my timeouts were happening on the
count_kprimessection, rather than the
After refining the my algorithm to count primes, it all turned green!
What a fun problem, though the second task, for large inputs, could be a task of its own.