whats wrong in this code?
Recursion-key pad codes
instead of writing ans=ansx3 you have to write
ans+=ansx3;
it is not correct for all test cases
check again it is passing all testcases
check it for input=19…

ans should 6 but it is giving 9
for(int i=0;i<n;i++){
if(in[i]==‘0’);
else if(in[i]==‘6’)ans=ans4;
else if(in[i]==‘8’|| in[i]==‘9’)ans=ans2;
else ans=ans*3;
}
correct one should be this as in[] is character array so we have to put nos inside single quote
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.