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
arjun:
2015-11-06 05:35:12
Declare all the variables as Global and the char array size must be >=2001.
|
|
dig:
2015-10-30 21:25:14
nice one...
|
|
alok singh:
2015-09-30 13:13:41
no comment.... :P |
|
gutsav:
2015-09-25 04:51:36
AC in one go 0.17 s :D |
|
dwij28:
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 )
|
|
D:
2015-08-30 09:39:12
Beautiful DP problem!! |
|
ultimatedbz:
2015-08-28 03:55:10
"those who are getting SIGSEGV fault declare 2-D dynamic array globally with size 3000.." -anuveshkothari is right |
|
monkz:
2015-08-26 20:27:03
Can it be solved using LCS? |
|
anuveshkothari:
2015-08-18 16:45:17
declaring char array globally instead of dynamic array costed in 3 segmentation error...
|
|
rahulwahi:
2015-08-08 20:05:58
declare 2D array Globally if u are getting SIGSEGV fault |
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 |