import java.util.*;
public class Main {
public static int count=-1;
public static void main(String args[]) {
int n=2;
Toh(n,βT1β,βT2β,βT3β);
System.out.println(count);
}
public static void Toh(int n,String T1,String T2,String T3){
if(n==0){
count++;
return;
}
Toh(n-1,T1,T3,T2);
System.out.println("move "+n+"th disc from β+T1+β to "+T2);
Toh(n-1,T3,T2,T1);
}
}
here i am getting all test cases wrong make the correction in the code
Test cases are wrong
Hi @ketushubham098
First of all you have to take input from user so make this code user inputable and 2nd mistake in your code is in Sample Output it is given that How you have to print output so please make sure that you are printing it in that way only . If you even write any letter small instead of Captial for example move instead of Move you will not pass any testcase.
Make these changes in your code it will helpβ¦
I hope Iβve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.