[LeetCode C++实现]583. Delete Operation for Two Strings
class Solution {
public:
int minDistance(string word1, string word2) {
int m = word1.size(),n = word2.size();
int l = lcs(word1,word2,m,n);
return m + n -2 * l;
}
private:
int lcs(string word1,string word2,int m,int n) {
if(m == 0 || n == 0) return 0;
if(word1[m - 1] == word2[n - 1]) {
return 1 + l......