Submit | All submissions | Best solutions | Back to list |
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
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 |
hide comments
|
||||||||||||||
2015-08-08 05:46:13
5 WAs because of a wrong minimum function :( |
||||||||||||||
2015-07-31 14:28:50
Getting wrong ans with string and getline whereas AC with char array and scanf :?? |
||||||||||||||
2015-07-26 21:43:57 iammangod96
Use Wagner-Fischer algorithm directly. If you are getting segmentation fault then please use static keyword for declaring the 2-d array. |
||||||||||||||
2015-07-24 19:34:26
top down + memo =tle dp:) |
||||||||||||||
2015-07-20 14:37:56
Dp :p 0.48 sec in JAVA ;p |
||||||||||||||
2015-07-18 12:42:29
can I have some test cases...? |
||||||||||||||
2015-07-17 12:49:06 Akshay Aradhya
Dont understand how the Problem title relates with the problem |
||||||||||||||
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 :). |
||||||||||||||
2015-07-02 09:11:16 mohit
"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 |
||||||||||||||
2015-07-01 10:29:34 Kartik
@manish sombansh: try 2001, because last character is always reserved for '\0' |