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
Find optimal substructure .Rest of the things are easy.
ac in one go :-) try MBLAST after that..
getting TLE with python and AC with c++ ;f**k cost 2 WA
top down TLE, bottom up AC !!
edit distance first problem solved.... Yesssss.
AC in one go:)
challenge : do with dp ; ^_^
Awesome Problem!! Good Dp practice. finally AC after quite a few WA's!
comments help a lot earlier i was getting runtime error ((SIGSEGV)).thanks @ranjanakash166.
@annu: It may be the fact the memory you allocate in the stack has overflowed.On the other hand, the global allocation has much more memory than stack at its disposal.However, all the parameters mentioned are configurable.