Skip to content

Commit 934520b

Browse files
Create README - LeetHub
1 parent d421caf commit 934520b

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

0072-edit-distance/README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<h2><a href="https://leetcode.com/problems/edit-distance">72. Edit Distance</a></h2><h3>Medium</h3><hr><p>Given two strings <code>word1</code> and <code>word2</code>, return <em>the minimum number of operations required to convert <code>word1</code> to <code>word2</code></em>.</p>
2+
3+
<p>You have the following three operations permitted on a word:</p>
4+
5+
<ul>
6+
<li>Insert a character</li>
7+
<li>Delete a character</li>
8+
<li>Replace a character</li>
9+
</ul>
10+
11+
<p>&nbsp;</p>
12+
<p><strong class="example">Example 1:</strong></p>
13+
14+
<pre>
15+
<strong>Input:</strong> word1 = &quot;horse&quot;, word2 = &quot;ros&quot;
16+
<strong>Output:</strong> 3
17+
<strong>Explanation:</strong>
18+
horse -&gt; rorse (replace &#39;h&#39; with &#39;r&#39;)
19+
rorse -&gt; rose (remove &#39;r&#39;)
20+
rose -&gt; ros (remove &#39;e&#39;)
21+
</pre>
22+
23+
<p><strong class="example">Example 2:</strong></p>
24+
25+
<pre>
26+
<strong>Input:</strong> word1 = &quot;intention&quot;, word2 = &quot;execution&quot;
27+
<strong>Output:</strong> 5
28+
<strong>Explanation:</strong>
29+
intention -&gt; inention (remove &#39;t&#39;)
30+
inention -&gt; enention (replace &#39;i&#39; with &#39;e&#39;)
31+
enention -&gt; exention (replace &#39;n&#39; with &#39;x&#39;)
32+
exention -&gt; exection (replace &#39;n&#39; with &#39;c&#39;)
33+
exection -&gt; execution (insert &#39;u&#39;)
34+
</pre>
35+
36+
<p>&nbsp;</p>
37+
<p><strong>Constraints:</strong></p>
38+
39+
<ul>
40+
<li><code>0 &lt;= word1.length, word2.length &lt;= 500</code></li>
41+
<li><code>word1</code> and <code>word2</code> consist of lowercase English letters.</li>
42+
</ul>

0 commit comments

Comments
 (0)