Guru Level
Implement the method editDistance that returns the minimum number of edits needed to convert one string into another.
Allowed edits are insert one character, delete one character, or replace one character.
The task is designed to test careful handling of edge cases, not only the most common input.
- Each edit costs
1. - Return
0if the strings are already equal. - The whole source string must be converted into the whole target string.
Use a dynamic programming table where dp[i][j] is the best answer for the first i and j characters.