Verified Commit c4de4bce authored by ynerant's avatar ynerant
Browse files

Avoid duplicates

parent b591a6d7
......@@ -196,6 +196,10 @@ func InsertWord(arr []word, w word) []word {
return append(arr, w)
}
w2 := arr[len(arr)-1]
if w.content == w2.content {
// The word is already present
return arr
}
if w.distance < w2.distance {
return append(arr, w)
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment