Skip to content

Instantly share code, notes, and snippets.

@NEbere
Created September 5, 2017 01:36
Show Gist options
  • Save NEbere/43e432e2385059ddc602d659ac858510 to your computer and use it in GitHub Desktop.
Save NEbere/43e432e2385059ddc602d659ac858510 to your computer and use it in GitHub Desktop.
# 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