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
Great problem!! Declare a global array , it will save you a wrong answer :)
Learnt something new :D
For Python, use PyPy 2.6.0
Please make sure that ur array for both a and b should be of size 2001 , in case of 2000 it will show wrong answer .
After lot's of effort, finally AC !!
Taking string input using cin.getline gives WA used scanf with %s and it worked. What is the reason??
Getting WA. Can anyone give edge cases. Tried everything got accept on two other portals with same algo.
:lol: i solved MBLAST first :vLast edit: 2017-05-02 05:18:56
Then what is the output for "AGGTAB" and "GXTXAYB" ??
@abbi_18 At any given point you just require only n-elements, hence you don't need to store n*n elements. If you think in this direction you'll be able to reduce space complexity from O(n^2) to O(n).