PythiloHard · 35 min · Task 18 of 20 · progress kept in this browser

Edit distance

How many single-character edits turn one string into another? An edit is an insertion, a deletion or a substitution.

edit_distance("book", "back")  # 2
edit_distance("", "abc")       # 3
Your task

Write edit_distance(a, b) returning the minimum number of insertions, deletions and substitutions needed to turn a into b.