Method to calculate the minimum edit (Levenshtein) distance.