You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/* Tower of Hanoi is a mathematical puzzle where we have three rods and n disks. The objective of the puzzle is to move the entire stack to another rod, obeying the following simple rules:
3
+
4
+
1. Only one disk can be moved at a time.
5
+
2. Each move consists of taking the upper disk from one of the stacks and placing it on top of another stack i.e. a disk can only be moved if it is the uppermost disk on a stack.
6
+
3. No disk may be placed on top of a smaller disk.
7
+
*/
8
+
9
+
#include<iostream>
10
+
usingnamespacestd;
11
+
12
+
voidtowerofHanoi(int n, char src, char helper ,char dest){
0 commit comments