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?
Operations are:
- 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
Input
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.
Output
For each test case, one line, minimum number of operations.
Example
Input: 1 FOOD MONEY Output: 4
hide comments
Kaustubh Mallik:
2015-01-22 06:29:02
Even 2D array solution is accepted. :D |
|
Takanori MAEHARA:
2015-01-18 16:59:55
@simple
|
|
Infinity:
2014-10-18 08:39:53
my time 1.21
|
|
mandu_ism:
2014-10-05 23:52:48
Made a mistake in calculating min!!
|
|
mayank:
2014-09-29 10:48:32
There is no need for 1D array, in C++ at least. :) |
|
Trương Ngọc Duy:
2014-09-24 05:12:50
Edit size MAX 3000 ... NOT 2000! |
|
Trương Ngọc Duy:
2014-09-24 05:07:37
How to using 1D ??? help me ! |
|
bhumik:
2014-09-20 16:50:56
What is answer for
|
|
deCodeIt:
2014-09-13 07:11:37
gave SIGSEV error with 2D array... as memory exceeded.. But worked awesome with 1D.... :) (y) |
|
mitz:
2014-08-17 13:53:40
good one!!!
|
Added by: | Mislav Balunović |
Date: | 2010-02-28 |
Time limit: | 15s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: NODEJS OBJC PERL6 SQLITE VB.NET |
Resource: | Internet |