Intresting Encoding

Sir my code is giving some error. It is unable to pass all the test cases.
Pls check and let me know where am i going wrong.

ide : https://ide.codingblocks.com/s/195840

wait i am trying to debug it

Bro

the dp array is a being wrongly updated:
apply the following logic which is simpler to understand with fewer if else condition
make dp array of len+1 size

int i=0;
dp[0] = 1; dp[1] = 1;
for(i=2;i<=len;i++)
{
dp[i] = 0 ;
int c1 = s.charAt(i-2)-‘0’ , c2 = s.charAt(i-1)-‘0’;
if(c1 == 1 || ( c1 == 1 && c2 <= 6 )) dp[i] += dp[i-2];
if(c2 != 0 ) dp[i] += dp[i-1];
}
System.out.println(dp[len]);

Got this logic. But still unable to understand what is incorrect in my logic ?

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.