[TIL] Algorithms Day 11 - Recursion, Sort
Problem 1. Hanoi Tower - Recursion
n = int(input())
def hanoi(n, start, mid, target):
if n == 1: # we can count the steps here
print(start, target)
return
hanoi(n-1, start, target, mid) # move 1st to (n-1)nd disks to mid
...
siwonlog.hashnode.dev2 min read