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
|
||||||||||||||
2017-12-19 11:13:00
Note : 1. Do it yourself. 2.Can refer web/youtube. 3.Again code yourself implementing the logic 4.Dont forget to clear the buffer using cin.ignore() :p costed me 2WA |
||||||||||||||
2017-09-16 19:12:14
I tried to solve it by finding LCS....the cout << max(s.length(),s1.length()) - LCS << endl; still got WA |
||||||||||||||
2017-08-29 10:34:47
Levenshtein distance ... :) |
||||||||||||||
2017-08-29 05:02:13
stop reading comments |
||||||||||||||
2017-06-22 17:55:15
same code accepted in c++ , WA in Java. |
||||||||||||||
2017-05-27 13:16:55 arvind002
Great problem!! Declare a global array , it will save you a wrong answer :) |
||||||||||||||
2017-05-22 17:53:23
Learnt something new :D |
||||||||||||||
2017-05-20 16:25:46
For Python, use PyPy 2.6.0 |
||||||||||||||
2017-05-18 17:08:23
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 . Costed me 2 WA ... |
||||||||||||||
2017-05-16 05:04:19
After lot's of effort, finally AC !! |