TypeScript Frog Jmp
function frogJmp(x: number, y: number, d: number): number {
return Math.ceil((y - x) / d);
}
This computes the jump count with math instead of simulation, which is the cleanest way to solve it.
function frogJmp(x: number, y: number, d: number): number {
return Math.ceil((y - x) / d);
}
This computes the jump count with math instead of simulation, which is the cleanest way to solve it.