Sample test case is giving correct output but code is not getting accepted

#include
using namespace std;
void helper(int n,char* output,int j,int &count){
//base case
if(j>=n){
output[j]=’\0’;
count++;
return;
}

//recursive case
//all a’s will be printed
output[j]=‘a’;
helper(n,output,j+1,count);
//all b’s will be printed;
if(output[j-1]!=‘b’){
output[j]=‘b’;
helper(n,output,j+1,count);
}
}
int main() {
int test;
cin>>test;
int i=0;
while(i<test){
int n;
cin>>n;
char output[100];
int count=0;
helper(n,output,0,count);
cout<<"#"<<n<<" “<<”:"<<" "<<count<<endl;
i++;

}

}

hi @uvanshika,
updated

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.

1 Like

its cleared.thankyou