Delete Characters to Equalize Strings
Given two lowercase alphabet strings a
and b
, consider an operation where we delete any character in either string. Return the minimum number of operations required such that both strings are equal.
Constraints
0 ≤ n ≤ 1,000
wheren
is the length ofa
0 ≤ m ≤ 1,000
wherem
is the length ofb
https://binarysearch.com/problems/Delete-Characters-to-Equalize-Strings
Examples
Example 1
Input
- a =
zyyx
- b =
yfyx
Output
- answer =
2
Explanation
We delete the "z"
in a
and delete "f"
in b
Leave a comment