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:

  1. Delete one letter from one of strings
  2. Insert one letter into one of strings
  3. Replace one of letters from one of strings with another letter


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.


For each test case, one line, minimum number of operations.




hide comments
scorpion_ajay: 2017-01-06 09:18:05

beautiful question :)

Wumbolo: 2016-12-02 15:17:31

Resource is Internet? Really?

jmax315: 2016-11-16 22:12:22

Well. That was an exercise in humility.

aditya9125: 2016-10-15 12:04:19

Find optimal substructure .Rest of the things are easy.

Robin Chawla: 2016-10-08 21:52:16

ac in one go :-) try MBLAST after that..

shivam_64321: 2016-10-06 21:05:14

getting TLE with python and AC with c++ ;f**k cost 2 WA

Gaurav Dahima: 2016-09-17 19:10:31

top down TLE, bottom up AC !!

rayhan50001: 2016-08-30 06:32:32

edit distance first problem solved.... Yesssss.

madhavgaba: 2016-08-26 23:15:01

AC in one go:)

iharsh234: 2016-08-20 11:28:22

challenge : do with dp[2][2005] ; ^_^

Added by:Mislav Balunović
Time limit:15s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: NODEJS objc PERL 6 VB.net