Problem title
Difficulty
Avg time to solve

Course Schedule
Easy
15 mins
Reverse List In K Groups
Moderate
15 mins
Number Of Vehicles
Easy
15 mins
Sum of even & odd
Easy
15 mins
Number Pattern 1
Easy
10 mins
Diagonal Sum
Easy
23 mins
Binary Tree Pruning
Moderate
20 mins
Edit Distance
Moderate
30 mins
Minimum Elements
Moderate
40 mins
Longest Common Prefix
Moderate
40 mins
20

# Edit Distance

Difficulty: MEDIUM
Contributed By
Avg. time to solve
30 min
Success Rate
70%

Problem Statement

#### Edit Distance of two strings is the minimum number of steps required to make one string equal to the other. In order to do so, you can perform the following three operations:

``````1. Delete a character
2. Replace a character with another one
3. Insert a character
``````
##### Note:
``````Strings don't contain spaces in between.
``````
##### Input format:
``````The first line of input contains the string 'S' of length 'N'.

The second line of the input contains the String 'T' of length 'M'.
``````
##### Output format:
``````The only line of output prints the minimum "Edit Distance" between the strings.
``````
##### Note:
``````You do not need to print anything; it has already been taken care of. Just implement the given functions.
``````
##### Constraints:
``````0 <= N <= 10 ^ 3
0 <= M <= 10 ^ 3

Time Limit : 1sec
``````
##### Sample Input 1 :
``````abc
dc
``````
##### Sample Output 1 :
``````2
``````
##### Explanation For Sample Input 1 :
``````In 2 operations we can make the string T to look like string S. First, insert the character 'a' to string T, which makes it "adc".

And secondly, replace the character 'd' of the string T with 'b' from the string S. This would make string T to "abc" which is also the string S. Hence, the minimum distance.
``````
##### Sample Input 2 :
``````whgtdwhgtdg
aswcfg
``````
##### Sample Output 2 :
``````9
``````
Console