Travis build: 176 [cron]

This commit is contained in:
30secondsofcode
2018-08-02 19:51:06 +00:00
parent 22053cd21e
commit ae8c006535
10 changed files with 1671 additions and 1639 deletions

View File

@ -428,14 +428,14 @@ Calculates the number of changes (substitutions, deletions or additions) require
Can also be used to compare two strings as shown in the second example.
``` js
const levenshteinDistance = (string1, string2) => {
const levenshteinDistance = (string1, string2) => {
if(string1.length === 0) return string2.length;
if(string2.length === 0) return string1.length;
let matrix = Array(string2.length + 1).fill(0).map((x,i) => [i]);
matrix[0] = Array(string1.length + 1).fill(0).map((x,i) => i);
for(let i = 1; i <= string2.length; i++){
for(let j = 1; j<=string1.length; j++){
if(string2[i-1] === string1[j-1]){
for(let i = 1; i <= string2.length; i++) {
for(let j = 1; j<=string1.length; j++) {
if(string2[i-1] === string1[j-1]) {
matrix[i][j] = matrix[i-1][j-1];
}
else{