Erlang Frog Jmp
-module(frog_jmp).
-export([frog_jmp/3]).
frog_jmp(X, Y, D) ->
(Y - X + D - 1) div D.
This computes the jump count with math instead of simulation, which is the cleanest way to solve it.
-module(frog_jmp).
-export([frog_jmp/3]).
frog_jmp(X, Y, D) ->
(Y - X + D - 1) div D.
This computes the jump count with math instead of simulation, which is the cleanest way to solve it.