Count minimal number of jumps from position X to Y.
A simple challenge that requires a basic calculation rather than any form of iteration.
function solution(X, Y, D) {
return Math.ceil((Y-X)/D)
}
Count minimal number of jumps from position X to Y.
A simple challenge that requires a basic calculation rather than any form of iteration.
function solution(X, Y, D) {
return Math.ceil((Y-X)/D)
}