The Tower of Hanoi is a classic mathematical puzzle. You have 3 rods and n disks. The objective is to move all n disks from the source rod to the target rod using an auxiliary rod, following these rules:
- Only one disk can be moved at a time.
- A disk can only be placed on top of a larger disk or an empty rod.
- Each move consists of taking the top disk from one rod and placing it on another rod.
Print each move as "Move disk X from Rod A to Rod C".
- An integer
n(number of disks).
Input: n = 2
Output:
Move disk 1 from Rod A to Rod B
Move disk 2 from Rod A to Rod C
Move disk 1 from Rod B to Rod C