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.
same with me, thanks to your comment i was able to solve this kata.
Apologies, I only looked at this kata again today. I didn't receive a notification of your comment as it wasn't labeled as
Issue
.I'm not sure I follow though, can you expand? I'm trying to understand where the expectation of an
i32
comes from.The solution setup currently takes a
u8
for thelength
parameter and returnsu64
, so I expected the tests to infer that type and I didn't get any of the above warnings for my own solution either. I'm not sure why yours is returningi32
.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_patterns
to 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
puzzle
with 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_kprimes
section, rather than thepuzzle
section.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.
Same :D