loading...

re: Daily Challenge #280 - Driving School VIEW POST

FULL DISCUSSION
 
fn cost(mins: u8) -> u8 {
    if mins < 5 {
        return 0;
    }
    if mins < 65 {
        return 30;
    }

    let extra_time = (mins - 60) / 30 + if (mins - 60) % 30 > 5 { 1 } else { 0 };
    return 30 + (extra_time * 10);
}
Code of Conduct Report abuse