I am working on below challenge. http://codingbat.com/prob/p195413
Psedo code:
1. find length of str starting and ending with sub.
2. return the length
I wrote my code as below and not passing all tests
public int strDist(String str, String sub) { if (str.length() <2){ return 0; } if (str.startsWith( sub) { return 1 + strDist(str.substring(2)); } else { return strDist(str.substring(1)); }}