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?
- 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
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.
Input: 1 FOOD MONEY Output: 4
non of the comments help us with the syntax of reading an empty line. untill i know it i'll just keep seeing these wa wa wa wa wa
wa on every submissionsLast edit: 2022-08-12 23:36:27
wagner fischer algorithm
Got an AC with DP. A simple Edit Distance application of DP.
C++ users, take input using cin... getline gives WA
AC in one go after reading concept in CLRS and one video. good start on a DP
Careful with the case a=0 && b=0
Initially I used strings which gave WA. Taking char arrays instead resulted in accepted code.
pass string with reference
Last edit: 2021-05-16 18:04:11
|Added by:||Mislav Balunović|
|Cluster:||Cube (Intel G860)|
|Languages:||All except: NODEJS OBJC PERL6 SQLITE VB.NET|