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.
liters is spelled wrong. Its liters not litres.
There is no reason for the Rust version of this kata to have an
i32
return value. First,i32
isn't big enough for all possiblef64
inputs. Second, the answer should never be negative, so you should encode that in the type system by using an unsigned int.This Kata is not very robust. Big values for time would lead to invalid results as Double exceeds Integer by far. Double max comes at 2^52 while Integer can hold up to 2^32 considering the result value is on a fringe case 2^51 we will have to deal with overflow. Long would be the more appropriate output value for Double. Alternative to Long would be Float as an input parameter. Further negative inputs are not considered.
That beeing said that are edge cases that are highly unlikely.
Personally I find this description kinda confusing.
'Nathan drinks 0.5 liter every 1 hour.'
This way it makes no sense that for 11h he drank 5l instead of 5.5l.
It's more like he drinks 1l every 2h.
I know it's about semantics, but in my case it made this simple kata hard, cuz I rounded wrong thing to smalles number as it matched the description better in my eyes.
In the examples you specify 'litres' but in the solution you ask for 'liters'. You should have conformity here. Probably also should specify which columns you want returned.