-2

How to advance edit distance with operation take an anagram of the existing word. every interim step must be a word from a list of words .

1 Answers1

3

The standard technique for anagrams is to store words in canonical sorted order, e.g. "Banana" becomes "aaabnn". Do that for all valid words, then consider Levenshtein distances between those. You will want to map from canonical to a valid set, e.g. valid['dgo'] = {'dog', 'god'}

Take a look at tail /usr/share/dict/words if you need a set of valid words.

J_H
  • 17,926
  • 4
  • 24
  • 44