Base condition problem

i think my base conditions are wrong
please check my code

if(i==C.length() && b1==0 && b2==0 && carry==0)
return 1;
else if(i==C.length())
return 0;
should be the base case,
also take care of b1>0 and b2>0 individually inside while calculating result!

that is if you are doing b1-1 only when b1>0

not able to get correct answer, don’t know why

please see the modified code-: https://ide.codingblocks.com/s/303961

i am getting 54 in this testcase-: 369 428 797

but the answer is 56

@S18CRX0174 take correct Ci
int Ci=C.charAt(C.length() - i - 1)-‘0’;

thanks, do you generally code in java?

@S18CRX0174 No I do in C++

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.