Created
March 30, 2024 15:56
-
-
Save rongpenl/3cdbdd055722adf7300a631dc5bb3876 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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