Edit Distance Recursive solution
Author: Syed0208Created Feb 4, 2021Updated Feb 4, 2021
Please change the recursive call to find the min by removing the check for same characters and make that condition as a separate one (as it is producing wrong output).
code:
if(str1[len1] == str2[len2])
return recEditDistance(str1, str2, len1 + 1, len2 + 1);
return 1 + min(recEditDistance(str1, str2, len1 + 1, len2 + 1),
recEditDistance(str1, str2, len1, len2 + 1),
recEditDistance(str1, str2, len1 + 1, len2)); Source: mission-peace/interview