my code
https://ide.codingblocks.com/s/40816
question link
https://hack.codingblocks.com/contests/c/512/96
please correct the code and explain a litlte about my mistake
my code
https://ide.codingblocks.com/s/40816
question link
https://hack.codingblocks.com/contests/c/512/96
please correct the code and explain a litlte about my mistake
You must be getting runerror as you are not returning anything from the recursive function .
So , concept is pretty easy . In every recursive call iterate on current string of table[ ] and save the present character and call on the next recursion .
I have written the function for printing output strings .You can take a look on it !
void rec(string s, int i , string out){
if(!s[i]){ print s ; return}
int index=s[i]-‘0’;
for(int k=0;table[index][k];k++)
rec(s,I+1,out+table[index][k]);
}
please simply comment and correct my code on a new ide
and cause am having a hard time understand this
and to implement what u have written in my code
please reply …