Codility FrogJump Java  

by ne on 2022-02-16 under Algo/DS/Problems tagged with codility

Hi,
The problem description is in the comments above the solution below.

The problem belongs to Codility, you can try out it yourself on their platform.


/**
 * Return number of jumps required by frog to jump from X to Y with jump size D
 */
public class FrogJump {
    public int solution(int X, int Y, int D) {
        int p = (Y - X) / D;
        if (p * D < (Y - X))
            return p + 1;
        return p;
    }
}