Levenshtein distance with bound/limit
问题 I have found some Python implementations of the Levenshtein distance. I am wondering though how these algorithms can be efficiently modified so that they break if the Levenshtein distance is greater than n (e.g. 3) instead of running until the end? So essentially I do not want to let the algorithm run for too long to calculate the final distance if I simply want to know if the distance is greater than a threshold or not. I have found some relevant posts here: Modifying Levenshtein Distance