Smart keypad 1 problem from recursion

I don’t understand why it’s failing one case when it passes another?

Hey @div_yanshu07 you are not passing single test case because it consist of zero digit also. As it’s not mentioned in the question(fault by problem setter) . When you encountered 0 , you have to add a space just like you did for when you get 1. Right now you are just avoiding and not adding anything .
int digit=in[i]-‘0’;

if(digit==0)

{

   generateNames(in,out,i+1,j);

}
so make this small change that when you encounter 0 you add a space just like for 1
Do this and you will surely pass all test cases :smile:. Keep coding :+1:

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.