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
komodo:
2015-08-08 05:46:13
5 WAs because of a wrong minimum function :( |
|
meghamittal92:
2015-07-31 14:28:50
Getting wrong ans with string and getline whereas AC with char array and scanf :?? |
|
iammangod96:
2015-07-26 21:43:57
Use Wagner-Fischer algorithm directly.
|
|
maan_j:
2015-07-24 19:34:26
top down + memo =tle
|
|
divp:
2015-07-20 14:37:56
Dp :p 0.48 sec in JAVA ;p |
|
anavgupta31:
2015-07-18 12:42:29
can I have some test cases...?
|
|
Akshay Aradhya:
2015-07-17 12:49:06
Dont understand how the Problem title relates with the problem |
|
moaz_eldefrawy:
2015-07-10 03:26:03
to convert FOOD to MONEY . is just 2 steps . because you can just sell it :D :D . by giving the food and taking the money :). |
|
mohit:
2015-07-02 09:11:16
"https://en.wikipedia.org/wiki/Levenshtein_distance" Iterative with full matrix.. global var for matrix a must Last edit: 2015-07-02 09:21:24 |
|
Kartik:
2015-07-01 10:29:34
@manish sombansh: try 2001, because last character is always reserved for '\0' |
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 |