here is the full code for LeeCode
question 91
;
I wanna run a test case in Java Visualizer
but kept getting issues like that. Idk how to normally run an example like this to see how everything works.
public class ClassNameHere {
public static void main(String[] args) {
numDecodings("2622");
}
public int numDecodings(String s) {
return s.length() == 0 ? 0 : numDecodings(0, s);
}
private int numDecodings(int p, String s) {
int n = s.length();
if (p == n) return 1;
if (s.charAt(p) == '0') return 0;
int res = numDecodings(p+1, s);
if (p<n-1 && (s.charAt(p) == '1' || s.charAt(p) == '2' && s.charAt(p+1) < '7'))
res += numDecodings(p+2, s);
return res;
}
}
I searched in Google and saw multiple anwsers firstly for how to executing code in Java Visulizer
even checked the videos but understood nothing; then I searched specific quetsions showed in Java Visualizer
. Both didn't work.