Edit Distance of Two Given String [ Amazon ]

Problem:Given two strings str1 and str2 and below operations that can performed on str1. Find minimum number of edits (operations) required to convert ‘str1′ into ‘str2′.

a.Insert
b.Remove
c.Replace

All of the above operations are of cost=1.Both the strings are of lowercase.

Hint: Use DP to solve the problem. This problema also can be solved using LCS. LCS needs to be applied on the string and its reverse string.

Link

 

Comments are closed.