package leetcode;

/**
 * https://leetcode.com/problems/decode-ways/
 */
public class Problem91 {
    public int numDecodings(String s) {
        // TODO
        return 0;
    }

    public static void main(String[] args) {
        Problem91 prob = new Problem91();
        System.out.println(prob.numDecodings("12"));
    }
}

@@ -12,16 +12,65 @@
 tcode;%0A%0A
+import java.util.HashMap;%0Aimport java.util.Map;%0A%0A
 /**%0A * h
@@ -192,32 +192,1120 @@
     
-// TODO%0A        return 0
+Map%3CString, Character%3E charMap = getCharMap();%0A        return numDecodings(s, charMap, s.length()) + 1;%0A    %7D%0A%0A    private int numDecodings(String s, Map%3CString, Character%3E map, int limit) %7B%0A        if (limit %3C= 2) %7B%0A            if (map.containsKey(s)) %7B%0A                return 1;%0A            %7D%0A            return 0;%0A        %7D%0A        int n = 0;%0A        for (int i = 0; i %3C s.length()-1; i++) %7B%0A            String s1 = s.substring(0, i+1);%0A            String s2 = s.substring(i+1);%0A            if (map.containsKey(s1)) %7B%0A                n++;%0A            %7D%0A            if (map.containsKey(s2)) %7B%0A                n++;%0A            %7D%0A            System.out.println(s1 + %22 %22 + s2);%0A            int n1 = numDecodings(s1, map, limit-1);%0A            int n2 = numDecodings(s2, map, limit-1);%0A            n += n1 + n2;%0A        %7D%0A        return n;%0A    %7D%0A%0A    private Map%3CString, Character%3E getCharMap() %7B%0A        Map%3CString, Character%3E map = new HashMap%3C%3E();%0A        int c = (int) 'a';%0A        for (int i = 1; i %3C= 26; i++) %7B%0A            map.put(Integer.toString(i), (char) c);%0A            c++;%0A        %7D%0A        return map
 ;%0A  
@@ -1392,24 +1392,26 @@
 roblem91();%0A
+//
         Syst
@@ -1451,16 +1451,127 @@
 %2212%22));%0A
+//        System.out.println(prob.numDecodings(%22215%22));%0A        System.out.println(prob.numDecodings(%221215%22));%0A
     %7D%0A%7D%0A

Update problem 91