Skip to content

Instantly share code, notes, and snippets.

@NEbere NEbere/frog_jump.py
Created Sep 5, 2017

Embed
What would you like to do?
# Python2 solution for codility frog jump question
# https://codility.com/programmers/lessons/3-time_complexity/frog_jmp/
import math
def solution(X, Y, D):
# write your code in Python 2.7
source_and_destination_difference = Y - X
fixed_distance_jump = D
total_jumps = int(math.ceil((source_and_destination_difference)/float(fixed_distance_jump)))
print total_jumps
return total_jumps
# function call, returns 3
solution(10, 85, 30)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.