91.解码方法
public int numDecodings(String s) { char s1[] = s.toCharArray(); int N = s1.length; int dp[] = new int[N + 1]; dp[N] = 1; for(int index = N - 1;index >= 0;index --) { if(s1[index] == '0') { continue; } int ways = dp[index + 1]; if(index + 1 >= s1.length) { dp[index] = ways; continue; } int num = (s1[index] - '0') * 10 + s1[index + 1] - '0'; if(num <= 26) { ways += dp[index + 2]; } dp[index] = ways; } return dp[0]; }