Tower of Hanoi

Medium

📝 Description

Solve Tower of Hanoi problem for n disks

Input Format

Number of disks

Output Format

Sequence of moves

Constraints

1 ≤ n ≤ 10

🔍 Sample Input

3
            

✅ Sample Output

Move disk 1 from A to C
Move disk 2 from A to B
...
            

Code Editor

Please login to run and submit code.

Shortcuts: Ctrl+Enter to submit, Ctrl+Shift+R to run