Rust Frog Jmp
fn frog_jmp(x: i64, y: i64, d: i64) -> i64 {
let dist = y - x;
(dist + d - 1) / d
}
This computes the jump count with math instead of simulation, which is the cleanest way to solve it.
fn frog_jmp(x: i64, y: i64, d: i64) -> i64 {
let dist = y - x;
(dist + d - 1) / d
}
This computes the jump count with math instead of simulation, which is the cleanest way to solve it.