EDIST - Edit distance
You are given two strings, A and B. Answer, what is the smallest number of operations you need to
transform A to B?
- Delete one letter from one of strings
- Insert one letter into one of strings
- Replace one of letters from one of strings with another letter
T - number of test cases
For each test case:
- String A
- String B
Both strings will contain only uppercase characters and they won't be longer than 2000 characters.
There will be 10 test cases in data set.
For each test case, one line, minimum number of operations.
Input: 1 FOOD MONEY Output: 4
A nice problem of dynamic programming. For beginners it is a good one. Just remember to declare all the arrays , strings globally , else you will get a runtime error. Costed me a WA.
Empty strings are to be taken care of too.
ac in 3 gos using dog biscuit
Last edit: 2018-06-14 16:27:06
Just a simple editDistance problem .
this problem can't be solve in this way :
AC in one go!!! = Why I hate SPOJ community
Pass strings through reference, costed TLE :(
standard dp problem