Skip to content

Commit 50401df

Browse files
authored
Update 642-design-search-autocomplete-system.js
1 parent 7ee83f2 commit 50401df

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

642-design-search-autocomplete-system.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@ const AutocompleteSystem = function (sentences, times) {
66
this.trie = new Trie()
77
this.inputString = ''
88
this.MAX_RESULTS = 3
9-
for (let i = 0; i < times.length; i++) {
10-
const sentence = sentences[i]
11-
this.trie.insert(sentence, times[i])
9+
for (let i = 0, len = times.length; i < len; i++) {
10+
this.trie.insert(sentences[i], times[i])
1211
}
1312
}
1413

0 commit comments

Comments
 (0)