Elixir Frog Jmp
defmodule FrogJmp do
def frog_jmp(x, y, d), do: ceil((y - x) / d)
end
This computes the jump count with math instead of simulation, which is the cleanest way to solve it.
defmodule FrogJmp do
def frog_jmp(x, y, d), do: ceil((y - x) / d)
end
This computes the jump count with math instead of simulation, which is the cleanest way to solve it.