Edit distance

Write codeMedium25 minGoogle style

Your task

Return the Levenshtein edit distance between two strings a and b: the minimum number of single-character insertions, deletions, or substitutions needed to turn a into b. For example, turning "kitten" into "sitting" takes 3 edits. Either string may be empty. Strings can be up to a few thousand characters, so use O(len(a)*len(b)) time and try to keep memory to O(min(len(a), len(b))).

Examples

edit_distance(a: str, b: str) -> int
Example 1
Inputedit_distance("kitten", "sitting")
Output3