We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 24ada2f commit 01bff2cCopy full SHA for 01bff2c
src/graphql/pyutils/suggestion_list.py
@@ -67,9 +67,16 @@ def measure(self, option: str):
67
for j in range(1, b_len + 1):
68
cost = 0 if a[i - 1] == b[j - 1] else 1
69
70
- d[i][j] = min(d[i - 1][j] + 1, d[i][j - 1] + 1, d[i - 1][j - 1] + cost)
+ current_cell = min(
71
+ d[i - 1][j] + 1, # delete
72
+ d[i][j - 1] + 1, # insert
73
+ d[i - 1][j - 1] + cost, # substitute
74
+ )
75
76
if i > 1 and j > 1 and a[i - 1] == b[j - 2] and a[i - 2] == b[j - 1]:
- d[i][j] = min(d[i][j], d[i - 2][j - 2] + 1)
77
+ # transposition
78
+ current_cell = min(current_cell, d[i - 2][j - 2] + 1)
79
+
80
+ d[i][j] = current_cell
81
82
return d[a_len][b_len]
0 commit comments