Given two strings word1 and word2, return the minimum number of deletions required to make the two strings equal. You may delete characters from either string, and the final strings must be identical. Pattern focus: LCS. The answer is derived from the longest common subsequence length.
word1 = first string, word2 = second string
minimum number of deletions
Example 1:
Input:
word1 = "sea" word2 = "eat"
Output:
2
Explanation:
Delete s from sea and t from eat.
Example 2:
Input:
word1 = "abc" word2 = "abc"
Output:
0
Explanation:
The strings are already equal.