Edit Distance
Given two strings of alphanumeric characters, determine the minimum number of Replace, Delete, and Insert operations needed to transform one string into the other.
Assumptions
Both strings are not null
Examples
string one: “sigh”, string two : “asith”
the edit distance between one and two is 2 (one insert “a” at front then replace “g” with “t”).
Solution: DP
TC: O(M*N) double for loop
SC: O(M*N) int[][] size
Last updated
Was this helpful?