Find Deletion Distance
Read at your own pace. Code execution, quizzes, progress tracking, and the AI tutor are available in the interactive view with JavaScript enabled.
Description
Can you determine the deletion distance between two strings? Let's define the deletion distance as the numbers of characters needed to delete from two strings to make them equal.

For example, the deletion distance of algo and daily is 5. The reason is we can delete the go (2 deletion) in algo, and the d, i and y (3 deletions) in daily.
Constraints
- Length of both the strings <=
1000 - The strings can be empty
- Take into consideration all the ASCII characters
- Let
mandnbe the the lengths ofstring 1andstring 2 - Expected time complexity
O(m*n) - Expected space complexity :
O(m*n)
```js
function deletionDistance(str1, str2) {
return '';
}
```
CONTINUE WITH ALGODAILY PREMIUM
Keep going with the complete tutorial.
Unlock the remaining explanations and exercises, alongside the full learning library.
Explore Premium →