Segmentation fault

where i am wrong i also have attached recursion tree.
my aim is to print all this but i am getting segmentation fault.
ideon - getting runtime error and one output(aaa)
when n=3;

Hey @officialharshit1996
U forgot to add a return statement in base case

if(i==n)
{
inp[i]=’\0’;
cout<<inp<<endl;
return;//added this
}

Also ,
try to find the pattern in output
for
1->2
2->3
3->5
4->8…

If this resolves ur query then please mark it as resolved :slight_smile:

after correcting mistake that u pointed out, i am not able to pass any case

this the code link - https://ide.codingblocks.com/s/354222

please share ur code in IDE? And whatis the issue exaclty? TLE or WA?

Hey @officialharshit1996
Sorry I missed this one, do u still have doubt in this ?

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.