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
|
||||||||||||||
2020-09-20 21:16:14
"\n" costed me one WA. |
||||||||||||||
2020-09-09 21:26:45
Use scanf for taking input(including numbers) |
||||||||||||||
2020-06-29 18:40:37
BOOM BOOM ! Its simple dp, why are u pple not getting it? |
||||||||||||||
2020-06-29 12:04:54
can't we use maps? |
||||||||||||||
2020-05-13 15:38:57
Use bottom-up approach,it will not give TLE. in top-down TLE is there as we reinitialize the dp array t times(t is no. of test cases). |
||||||||||||||
2020-04-19 15:54:50
can a input string be empty |
||||||||||||||
2020-02-27 15:34:18
aaj se meri saari galliyan teri ho gayi aaj se mera ghar tera ho gya tere kandhe ka jo til hai tere sine mein jo dil hai teri bijli ka jo bill hai aaj se mera ho gya tere khabo ka ambar teri khushiyo ka samandar ter pin code ka number aaj se mera ho gya Last edit: 2020-03-19 11:36:50 |
||||||||||||||
2020-02-18 06:55:45
To Solve This Using Wagner–Fischer algorithm. |
||||||||||||||
2020-01-25 00:19:05
It's possible to AC with Py3 here (https://www.spoj.com/ranks/EDIST/lang=PYTH%203.2.3) but with problems like this is always gonna be hard. Submit your code in PyPy. |
||||||||||||||
2020-01-24 17:28:27
I am getting TLE in all the approaches in python3. Is there anyone who got AC in python3? |