Three rods and several disks of varying sizes that may be slid onto any rod make up the Tower of Hanoi, a well-known mathematics puzzle. The smallest disk is at the top of the problem, and the largest disk is at the bottom, with the disks piled in increasing size on a single rod.
The puzzle's goal is to transfer the full stack to a different rod while adhering to the following guidelines:
You can only move one disk at a time.
In order to make a move, you must remove the topmost disk from a stack and place it on top of the stack either on an empty rod or another rod.
A smaller disk cannot be stacked on top of another disk. This rule guarantees that on any rod, the disks are always arranged from top to bottom in decreasing order.
Usually, the puzzle begins with the setup shown below: The A, B, and C rods are three. 4 disks total on a source rod (B), where 4 is the number of disks. An additional rod (A) suitable for short-term storage. The rod (C) that you wish to shift the full stack to is the target. The goal is to transfer every disk from the source rod (B) to the destination rod (C) while adhering to the previously stated guidelines and utilizing the auxiliary rod (A) when necessary.