Can you look at my solution and tell what changes should i make
Towerr of hanoi wrong test case
Hey @bhavik911
Output Format
Display the steps required to solve the tower and also print the total number of steps required
recursive code will like this
public static void TOH(int n ,String source, String auxillary , String destination){
if(n==1){
System.out.printf(“Move %dth disc from %s to %s”,n,source,destination);
System.out.println();
return;
}
TOH(n-1,source,destination, auxillary);
System.out.printf(“Move %dth disc from %s to %s”,n,source,destination);
System.out.println();
TOH(n-1,auxillary,source, destination);
}
How to count no of steps , I am not able to di it while keeping another parameter in my method
Not able to open editorial for this problem
System.out.println((int)(Math.pow(2, n))-1);
With 3 disks, the puzzle can be solved in 7 moves. The minimal number of moves required to solve a Tower of Hanoi puzzle is 2^n − 1, where n is the number of disks.