Edit distance between two symbols
Asked at Two Sigma
A reference-data pipeline needs to fuzzy-match ticker symbols across vendors ("BRK.B" vs "BRKB", "VOD LN" vs "VOD.L"). The workhorse metric is Levenshtein distance: the minimum number of single-character insertions, deletions, or substitutions turning string a into string b.
a = "horse", b = "ros"
-> 3 # horse -> rorse -> rose -> ros
Compute the edit distance. Target time, and can you do it in space?
Your answer
This one is open-ended. Work it through, then check your reasoning against the full solution.