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-11-06 05:35:12 arjun
Declare all the variables as Global and the char array size must be >=2001. Costed me 1 WA. Watch this: https://www.youtube.com/watch?v=We3YDTzNXEk |
||||||||||||||
2015-10-30 21:25:14 dig
nice one... top-down tle bottom up ac |
||||||||||||||
2015-09-30 13:13:41 alok singh
no comment.... :P |
||||||||||||||
2015-09-25 04:51:36
AC in one go 0.17 s :D |
||||||||||||||
2015-08-31 19:35:47
Brilliant question, worth the 3 hours spent, learnt so much, a must for beginners like me.. You could refer to this link for help : ( https://www.youtube.com/watch?v=We3YDTzNXEk ) Just a small issue, I used gets() in C and got a WA, just changed it to scanf() and got an AC. Is the input poorly fomatted ? Weird :/ |
||||||||||||||
2015-08-30 09:39:12 D
Beautiful DP problem!! |
||||||||||||||
2015-08-28 03:55:10
"those who are getting SIGSEGV fault declare 2-D dynamic array globally with size 3000.." -anuveshkothari is right |
||||||||||||||
2015-08-26 20:27:03 monkz
Can it be solved using LCS? |
||||||||||||||
2015-08-18 16:45:17
declaring char array globally instead of dynamic array costed in 3 segmentation error... those who are getting SIGSEGV fault declare 2-D dynamic array globally with size 3000.. Last edit: 2015-08-18 16:45:45 |
||||||||||||||
2015-08-08 20:05:58
declare 2D array Globally if u are getting SIGSEGV fault |