Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

Levenshtein distance

Transforming flawlawn

  • Edit distance: 2 single-character edits (insert / delete / substitute)
  • Similarity: 50%

DP table

Each cell d[i][j] is the distance between the first i runes of flaw and the first j runes of lawn. The bottom-right cell is the answer.

ε l a w n
ε 0 1 2 3 4
f 1 1 2 3 4
l 2 1 2 3 4
a 3 2 1 2 3
w 4 3 2 1 2

← back