September 19, 2021
class Solution {
public int solution(int X, int Y, int D) {
int count = (Y - X) / D;
int remainder = (Y - X) % D;
if (remainder>0) {
return count+1;
}
return count;
}
}
public int solution(int X, int Y, int D) {
double divideNum = (Y - X) * 1.0 / D;
return (int) Math.ceil(divideNum);
}