@@ -0,0 +1,701 @@
+/**%0A * Created by kiyan on 5/5/16.%0A */%0Apublic class OneEditDistance %7B%0A%0A    public boolean isOneEditDistance(String s, String t) %7B%0A        int m = s.length();%0A        int n = t.length();%0A        if (m %3E n) return isOneEditDistance(t, s); // n is always bigger%0A        if (n - m %3E 1) return false;%0A        int i = 0;%0A        int shift = n - m; // 0 or 1%0A        while (i %3C m && s.charAt(i) == t.charAt(i)) i++; // arrives at non-matching char%0A        if (i == m) return shift %3E 0; // whether T has more characters%0A        if (shift == 0) i++; // skip both%0A        while (i %3C m && s.charAt(i) == t.charAt(i + shift)) i++; // go on%0A        return i == m; // should reach the end of shorter string%0A    %7D%0A%7D%0A

add one edit distance