Go Frog Jmp
func frogJmp(x, y, d int) int {
return int(math.Ceil(float64(y-x) / float64(d)))
}
This computes the jump count with math instead of simulation, which is the cleanest way to solve it.
func frogJmp(x, y, d int) int {
return int(math.Ceil(float64(y-x) / float64(d)))
}
This computes the jump count with math instead of simulation, which is the cleanest way to solve it.