Convert word1 to word2 interview question
Posted: Mon Apr 06, 2009 11:12 pm
The following code problem is one of the Amazon sample interview questions. I think it is written poorly which may be why I don't understand it. I also can't find any posted solutions with a google search. If anyone can help that would be great. Either just elaborate if you think you understand it, or posting some code is good too.
You are given a dictionary of all valid words. You have the following 3 operations permitted on a word: delete a character, insert a character, and replace a character. Now, given two words, $word1 and $word2, write a script to convert $word1 to $word2 using the minimum number of steps required. (One operation counts as 1 step).
You are given a dictionary of all valid words. You have the following 3 operations permitted on a word: delete a character, insert a character, and replace a character. Now, given two words, $word1 and $word2, write a script to convert $word1 to $word2 using the minimum number of steps required. (One operation counts as 1 step).