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.
No random tests. Obsolete.
I think it would be better to change the type to
u64
and increase the input range accordingly. Or even consider use BigInt, it is more suited to Fibonacci, otherwise all values are easily hardcodable.We'll have to give it a week, as the system grants the kata author some time to respond before others can do so. Given that they haven't logged on for more than a month, it can likely be approved after next week.
Have a great day!
Hello!
I think you're absolutely right. Your proposed enhancements make the translation far easier to understand and align much more closely with idiomatic Rust principles. Thank you for taking the time to add and propose them.
Hey, another Rust translator!
It's good to see the removal of the default comments that are part of the tests.
I've added the below to the fork, but a few comments on the translation:
It's more idiomatic in this case to only return
n
and drop thereturn
, considering it is implicit in Rust.Regarding idiomatic Rust on Codewars, here are some tips that I try to be mindful of when translating:
In general while translating on Codewars, make sure to add random tests. For this you can use the
rand
crate in Rust.Typically what is used are 100 iterations at a minimum, excluding kata that have strict performance requirements. You might come across old kata that do not have random tests, but ideally these should also have random tests.
I've also made use of the custom message for an assertion to indicate what went wrong.
This is especially useful for users when debugging random tests.
We can also change the type to a
u32
as the 39-th fibonacci number doesn't overflow it.Maybe that's why it says Puzzles in the tags list? I think the kata's author wanted you to figure that out.
This comment is hidden because it contains spoiler information about the solution