1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-10 18:48:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/两个字符串的删除操作 [delete-operation-for-two-strings].html
2022-03-29 12:43:11 +08:00

31 lines
1021 B
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p>给定两个单词&nbsp;<code>word1</code>&nbsp;<meta charset="UTF-8" />&nbsp;<code>word2</code>&nbsp;,返回使得<meta charset="UTF-8" />&nbsp;<code>word1</code>&nbsp;&nbsp;<meta charset="UTF-8" />&nbsp;<code>word2</code><em>&nbsp;</em><strong>相同</strong>所需的<strong>最小步数</strong></p>
<p><strong>每步&nbsp;</strong>可以删除任意一个字符串中的一个字符。</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre>
<strong>输入:</strong> word1 = "sea", word2 = "eat"
<strong>输出:</strong> 2
<strong>解释:</strong> 第一步将 "sea" 变为 "ea" ,第二步将 "eat "变为 "ea"
</pre>
<p><strong>示例 &nbsp;2:</strong></p>
<pre>
<b>输入:</b>word1 = "leetcode", word2 = "etco"
<b>输出:</b>4
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<meta charset="UTF-8" />
<ul>
<li><code>1 &lt;= word1.length, word2.length &lt;= 500</code></li>
<li><code>word1</code>&nbsp;&nbsp;<code>word2</code>&nbsp;只包含小写英文字母</li>
</ul>