Bash Frog Jmp
frog_jmp() {
local _x=$1 _y=$2 _d=$3
echo $(( (_y - _x + _d - 1) / _d ))
}
This computes the jump count with math instead of simulation, which is the cleanest way to solve it.
frog_jmp() {
local _x=$1 _y=$2 _d=$3
echo $(( (_y - _x + _d - 1) / _d ))
}
This computes the jump count with math instead of simulation, which is the cleanest way to solve it.