What is the Tower of Hanoi?
A classic logic puzzle: move the whole stack of discs from the left peg to the right peg. You may move only one disc at a time, and a bigger disc can never sit on a smaller one. With n discs the minimum is 2ⁿ − 1 moves (7 for 3 discs, 63 for 6). Tap a peg to pick up its top disc, then tap another peg to drop it. Stuck? Watch the auto-solve.
How to use the Tower of Hanoi
- Choose the number of discs.
- Tap a peg to lift the top disc, tap another peg to place it.
- Move the full tower to the right peg in as few moves as possible.
Solution idea
To move n discs: move n−1 discs to the spare peg, move the biggest disc, then move the n−1 discs on top of it. This is the classic recursion example in programming.
This Tower of Hanoi is 100% free, needs no signup and runs privately in your browser – on phone, tablet or computer.
Last updated: · By NodifyTech