Five discs on the Tower of Hanoi
Three pegs; on the first sit five discs of different sizes, largest at the bottom. You may move one disc at a time, taking the top disc of one peg and placing it on another peg, and you may never put a larger disc on top of a smaller one.
- What is the smallest number of moves needed to transfer all five discs to another peg?
- According to the legend, monks are moving 64 discs at one move per second. Roughly how long will they take?
Show a hint
To move the largest disc, all the others must be stacked on the spare peg. So moving n discs costs "move n minus 1 discs, move the big one, move n minus 1 discs again".
Your answer
Solving needs a free account
Answers, streaks and solutions unlock when you are signed in. Reading the question and the hint stays free.
Discussion
Sign in to join the discussion · reading is open to everyone
💡 Discussion rules
- No full solutions here. Hints and approaches only.
- Complexity, edge cases and intuition are the point.
- Interview experiences are welcome. Respect your NDAs.
Loading discussion…
Learn the concepts
The theory behind this question.
Related questions
A hundred empty glasses and the dregsWhere to stand among 1024 piratesA million dollars or a penny doubled every day?A grain of rice on the first square, doubling on eachThe airplane on a treadmill
All questions →