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-04-04 09:51:36 Harish Reddy Kolanu
try using WagnerâFischer algorithm http://en.wikipedia.org/wiki/Wagner%E2%80%93Fischer_algorithm |
||||||||||||||
2015-03-21 12:52:32 Abhay Jain
Can somebody help. Its showing SIGSEGV error. Please help out. Code link: http://ideone.com/******** (Francky) => Please use forum for any help. (See the notes below). Last edit: 2015-03-21 14:12:29 |
||||||||||||||
2015-03-17 18:10:03 Arjun Verma
2d array accepted with global + static int |
||||||||||||||
2015-02-27 18:31:14 gratitude
should use dp or else tle :) |
||||||||||||||
2015-02-17 16:36:23 Daniel Carvalho
Sigsev for 2D array and non-global variables. Works with 1D and global. |
||||||||||||||
2015-02-16 17:17:04 Tejwinder Singh
I am frustated http://ideone.com/********** please help me out :( (Francky) => Please use forum, and read notes. Last edit: 2015-02-16 18:06:48 |
||||||||||||||
2015-02-06 20:03:28 Andrey Kaygorodov
@shankar should be 4 |
||||||||||||||
2015-02-04 19:31:21 shankar
what should be the answer for 1 qwert ertqw Answer should be 4 or 2 ? |
||||||||||||||
2015-02-04 01:32:40 Anubhav Gupta
Levenshtein distance |
||||||||||||||
2015-01-23 13:08:24 Abhay
Can someone provide me some sample test cases? The judge is giving me WA but I have been correct in all the examples I have tried. Edit: Found the mistake Last edit: 2015-01-23 13:21:32 |