5812: 【系列题】子序列(十)两个字符串的删除操作
Memory Limit:128 MB
Time Limit:1.000 S
Judge Style:Text Compare
Creator:zhengjh
Submit:4
Solved:3
Description
给定两个单词 word1
和 word2
,返回使得 word1
和 word2
相同所需的最小步数。
每步 可以删除任意一个字符串中的一个字符。
Input
两行字符串
第一行为word1
第二行为word2
Output
一个整数,即使得
word1
和 word2
相同所需的最小步数。Sample Input Copy
sea
eat
Sample Output Copy
2
HINT
样例说明:
输入:word1 = "sea", word2 = "eat"
输出:2
解释:第一步将 "sea" 变为 "ea" ,第二步将 "eat "变为 "ea"
1 <= word1.length,word2.length <= 500
word1 和 word2 只包含小写英文字母