title: how to efficiently check if the Levenshtein edit distance between two string is 1
body: <p>please note that it doesn't require to really calculate Levenshtein edit distance. just check it's 1 or not. </p>
  
  <p>The signature of the method may look like this: </p>
  
  <pre><code>bool Is1EditDistance(string s1, string s2). 
  </code></pre>
  
  <p>for example:
  1. "abc" and "ab" return true
  2. "abc" and "aebc" return true
  3. "abc" and "a" return false.</p>
  
  <p>I've tried recursive approve, but it it not efficient. </p>
  
  <hr>
  
  <p>update: got answer from a friend:</p>
  
  <pre><code>        for (int i = 0; i &lt; s1.Length &amp;&amp; i &lt; s2.Length; i++)
          {
              if (s1[i] != s2[i])
              {
                  return s1.Substring(i + 1) == s2.Substring(i + 1)   //case of change
                      || s1.Substring(i + 1) == s2.Substring(i)       //case of s1 has extra
                      || s1.Substring(i) == s2.Substring(i + 1);      //case of s2 has extra
              }
          }
          return Math.Abs(s1.Length - s2.Length) == 1;
  </code></pre>