Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Apr 20, 2024. It is now read-only.

Commit b5eb875

Browse files
updated README.md
1 parent e35c630 commit b5eb875

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

‎problem66/README.md‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# 72. Edit Distance
2+
3+
Given two strings word1 and word2, return the minimum number of operations required to convert word1 to word2.
4+
5+
You have the following three operations permitted on a word:
6+
7+
Insert a character
8+
Delete a character
9+
Replace a character
10+
11+
12+
## Example 1:
13+
14+
Input: word1 = "horse", word2 = "ros"
15+
Output: 3
16+
Explanation:
17+
horse -> rorse (replace 'h' with 'r')
18+
rorse -> rose (remove 'r')
19+
rose -> ros (remove 'e')
20+
21+
## Example 2:
22+
23+
Input: word1 = "intention", word2 = "execution"
24+
Output: 5
25+
Explanation:
26+
intention -> inention (remove 't')
27+
inention -> enention (replace 'i' with 'e')
28+
enention -> exention (replace 'n' with 'x')
29+
exention -> exection (replace 'n' with 'c')
30+
exection -> execution (insert 'u')
31+
32+
33+
## Constraints:
34+
35+
0 <= word1.length, word2.length <= 500
36+
word1 and word2 consist of lowercase English letters

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /