Tower of Hanoi recursive solution
Tower of Hanoi recursive solution
move a stack of disks from one peg to another, following three rules:
The recursive solution involves breaking down the problem into smaller
sub-problems:
1. Move n−1n - 1n−1 disks from the source peg to an auxiliary peg.
2. Move the largest disk from the source peg to the target peg.
3. Move the n−1n - 1n−1 disks from the auxiliary peg to the target
peg.
# Base case: If there's only one disk, move it directly from source to
target
if n == 1:
return
Explanation: