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 351c8e9 commit 8af5024Copy full SHA for 8af5024
one-away.js
@@ -6,7 +6,7 @@ function isOneEditAway(str1, str2) {
6
return false;
7
}
8
9
- for(i1 = 0, i2 = 0; i1 < str1.length && i2 < str2.length && edit <= 1; i1++, i2++) {
+ for(i1 = 0, i2 = 0; i1 < str1.length && i2 < str2.length; i1++, i2++) {
10
if(str1[i1] === str2[i2]) {
11
continue;
12
} else {
@@ -24,9 +24,6 @@ function isOneEditAway(str1, str2) {
24
25
26
27
- edit += str1.length - 1 - i1;
28
- edit += str2.length - 1 - i2;
29
-
30
return edit <= 1;
31
32
0 commit comments