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.
It's a good implementation, but by nature converting a number into a string is much more complicated than a simple while loop which runs a dozen or so times.
Sorting will take more time than it would to find the min & max
There are always 10 digits, so the type of the argument should be
[u8; 10]
or&[u8; 10]
.Random tests needed.
clean but slow
Description conflict.
to_string() is essentially a wrapper for impl Display. I think this is the u64 implementation of it: https://doc.rust-lang.org/src/core/fmt/num.rs.html#199-258 Looks like there is some cost, but I can't speak to how much of it is optimized out in release mode.
Does
to_string
cost much?Could you add random tests?
Yes, this was not a good Kata for me either. All of the description is completely misleading. There is no real mathematical or physics formula that works as a solution to the described process of drying potatoes. You simply have to find an arbitrary formula that relates the testcases to their results, completely disregarding all of the description. Not fun and not instructive.
I was disappointed that the answers were incorrect, had to figure out a way to calculate the wrong answer to finish the kata. This problem uses floating point math, not integer math.
105 is the correct answer to this problem. Do the math by hand, the right answer is 104.8695.