Skip to content

Instantly share code, notes, and snippets.

@rongpenl
Created March 30, 2024 15:56
Show Gist options
  • Save rongpenl/3cdbdd055722adf7300a631dc5bb3876 to your computer and use it in GitHub Desktop.
Save rongpenl/3cdbdd055722adf7300a631dc5bb3876 to your computer and use it in GitHub Desktop.
# Ron and Math: https://www.youtube.com/post/Ugkx-VJIlzGcL15mA4wX1kpkuKZq3634vYrh
def frog_jump():
steps = {(0,0): 1}
for x in range(5):
for y in range(5):
if (x,y) not in steps:
steps[(x,y)] = steps.get((x-1,y),0) + steps.get((x-2,y),0) + steps.get((x,y-1),0) + steps.get((x,y-2),0)
return steps[(4,4)] # 556
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment