LeetCode – One Edit Distance (Java)

Given two strings S and T, determine if they are both one edit distance apart. Java Solution public boolean isOneEditDistance(String s, String t) { if(s==null || t==null) return false;   int m = s.length(); int n = t.length();   if(Math.abs(m-n)>1){ return false; }   int i=0; int j=0; int count=0;   while(i<m&&j<n){ if(s.charAt(i)==t.charAt(j)){ i++; j++; … Read more