1
0
mirror of https://github.com/SunnyQjm/algorithm-review.git synced 2026-06-05 23:49:30 +08:00
This commit is contained in:
2020-06-28 16:25:03 +08:00
parent eb8d3279a8
commit 19bc63cf1b
49 changed files with 82 additions and 66 deletions
+2 -1
View File
@@ -29,6 +29,7 @@
# exection -> execution (插入 'u')
#######################################################################################
class Solution:
def minDistance(self, word1, word2):
"""
@@ -47,7 +48,7 @@ class Solution:
f(i, j) = j i == 0
i j == 0
f(i - 1, j - 1) i > 0 && j > 0 && word1[i] == word2[j]
min { i > 0 && j > 0 && word1[i] != word2[j]
min { i > 0 && j > 0 && word1[i] != word2[j]
f(i - 1, j) + 1,
f(i, j - 1) + 1,
f(i - 1, j - 1) + 1