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.
Oh, about that (I guess we're getting nitpicky): you never use negative numbers, so the type should probably be a
u32
instead ofi32
. Also, I believe it's good form to use&[&Vec...]
instead of&Vec<Vec...>
as the parameter type, though that is obviously more for real world applications instead of kata, where the type is always aVec
.Your assertions need proper messages to communicate to the user what the input and what their output was. You can refer to the tests in this kata for a comprehensive breakdown of recommended authoring practices in Rust.
I see you've authored a few Rust translations; may I suggest that you go back and apply this fix to all of them?
On a different note, the description is terribly JS/Python-centric, and could benefit from being made language agnostic (or by structuring properly with language blocks). Maybe you'd like to take that on as part of this translation.
approved.
It calculated 1.5 issues/week. However, I probably, maybe, possibly, uncertainly, likely used intermediate fractions in calculating the average, so you might actually be right, or even more wrong, would have to ask the author.
Approved, thanks.
Indeed, I should have tested my suggestion before asserting that it actually works.
Anyway, I've forked the translation and changed a few things.
Can you explain the logic in the creation of
max
andmin
in the random test? To me, it seems like a particularly complicated way of writing1
and-1
, respectively.If the point is avoiding overflow, I'd simply generated a random
i32::MIN < x < i32::MAX
, a randoma <= x
) andb = x / a
.Also, this kata really needs good, clear assertion messages.
Rejected, because:
Added rust-specific info to the description.
Rejecting, because:
n<1 or not an integer
is a typical relic from authoring in a weakly/none typed language like Python or JS. It makes absolutely no sense in a strongly typed language, where input types can't be arbitrary, nor can they accidentally be negative integers whenu32
is chosen. Usingu32
and ignoring the input handling, which is completely tangential to the task anyway, was the correct choice here.No longer an issue.
There is no point in forking a translation just to update the original solution (which would end up published in the original author's name anyway). Especially when there are other things that actually need fixing, e.g. missing assertion messages.
Rejected.
Good catch. Fixed.
Also made a typo trying to type "typo".
Loading more items...