Code not working

#include<bits/stdc++.h>
using namespace std; // tower of hanoi

int towerofhanoi(int n,string src,string dest,string helper){
int count =1;
if(n==0){
return 0;
}
count+=towerofhanoi(n-1,src,helper,dest);
cout<<"Move "<<n<<"th disk from “<<src<<” to "<<dest<<endl;

count+=towerofhanoi(n-1,dest,helper,src);
return count;

}

int main(){
int n;
cin>>n;
cout<<towerofhanoi(n,“T1”,“T2”,“T3”);
return 0;
}

Code is correct and also working for me


check here

which thing is not working for you @dhruvj797?

if you have further doubt Feel free to ask

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.

the test case didnt pass

your second recursion call is incorrect

correct statement will be
count += towerofhanoi(n - 1, helper, dest, src);

Modified code (same which send above also)

it is passing all testcases plz check

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.