Skip to content

Instantly share code, notes, and snippets.

@iafsilva
Created May 5, 2023 13:48
Show Gist options
  • Save iafsilva/63f3f3d2c4d8d18567340f343f34fa96 to your computer and use it in GitHub Desktop.
Save iafsilva/63f3f3d2c4d8d18567340f343f34fa96 to your computer and use it in GitHub Desktop.
FrogJmp
fun solution(x: Int, y: Int, d: Int): Int {
val distance = y - x
val jumps = distance / d
// If the jumps are 1.1, that means 2 jumps.
return if (distance % d == 0) jumps else jumps + 1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment