Skip to content

Instantly share code, notes, and snippets.

@Bablzz
Created November 20, 2019 11:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Bablzz/d851f94967d723c6272baa2499261049 to your computer and use it in GitHub Desktop.
Save Bablzz/d851f94967d723c6272baa2499261049 to your computer and use it in GitHub Desktop.
Tower of Hanoi
def solve(n, a, b, c):
if n > 0:
solve(n - 1, a, c, b)
print('Move disk from ' + a + ' to disk ' + b)
solve(n - 1, c, b, a)
solve(3, '1', '2', '3')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment