I would like to explain the Towers of Hanoi problem here. Unfortunately, it’s difficult to explain if you don’t use visual illustrations, and WordPress isn’t great for visual illustrations. Consequently, I recommend the Wikipedia page. But, to put the solution into a nutshell, the basic idea behind the algorithm is this:
If you have N rings on the source tower, then move the top N – 1 rings from the source tower to the spare tower. Then move the bottom Nth ring from the source tower to the destination tower in one move. Then move the N – 1 rings on the spare tower to the destination tower.
To move the N – 1 rings, you solve a subinstance of the original problem of size N – 1. So, it is natural to apply recursion.