C# Frog Jmp
static long FrogJmp(long x, long y, long d)
{
return (long)Math.Ceiling((double)(y - x) / d);
}
This computes the jump count with math instead of simulation, which is the cleanest way to solve it.
static long FrogJmp(long x, long y, long d)
{
return (long)Math.Ceiling((double)(y - x) / d);
}
This computes the jump count with math instead of simulation, which is the cleanest way to solve it.