This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package LevenshteinDistance | |
import "fmt" | |
import "math" | |
func compare(a, b string) int { | |
var cost int | |
d := make([][]int, len(a)+1) | |
for i := 0; i < len(d); i++ { | |
d[i] = make([]int, len(b)+1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func min(a1 int, a2 int, a3 int) int { | |
min := a1 | |
if a2 < min { | |
min = a2 | |
} | |
if a3 < min { | |
min = a3 | |
} | |
return min | |
} |