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?
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:
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.
time limit exceeded in python 3
i am using top down way with using memorization , it give me time limit exceed, id is 17197457 ,help me
@annu: It may be the fact the memory you allocate in the stack has overflowed.On the other hand, the global allocation has much more memory than stack at its disposal.However, all the parameters mentioned are configurable.
When the dp array is declared locally it gives run time error and when declared globally it awards you AC.Why?
declare dp array globally !AC in one GO
Got AC in the first attempt :) Very nice question. Declare global array of size 3000*3000
declare the dp matrix table globally if one wishes to do it in BOTTOM-UP dp...otherwise most likely to get runtime error ((SIGSEGV))
declare the " int dp " globally, got AC.
2 tle just for array size make sure it is 2101*2101 and global happy coding :)
my 1st dp..<3..AC after so many WA's..:D