i am getting wrong answer for all test cases. how can i reverse the sequence of output.
Recursion - subsequences
You can use the following approach in your code as :
void subseq(string input,string osf)
{
if(input.length()==0)
{
cout<<osf<<" ";
return;
}
char ch=input[0];
string ros=input.substr(1);
subseq(ros,osf);
subseq(ros,osf+ch);
return;
}
This is the same approach, only difference is that You have to use string, instead of char array…
can u make changes in my current code?