(word string, needsEnd bool)
| 49 | } |
| 50 | |
| 51 | func (this *Trie) search(word string, needsEnd bool) bool { |
| 52 | curr := this.root |
| 53 | for i := 0; i < len(word); i++ { |
| 54 | slot := word[i] - 'a' |
| 55 | if curr.children[slot] == nil { |
| 56 | return false |
| 57 | } |
| 58 | |
| 59 | curr = curr.children[slot] |
| 60 | } |
| 61 | |
| 62 | if needsEnd { |
| 63 | return curr.end |
| 64 | } |
| 65 | |
| 66 | return true |
| 67 | } |
no outgoing calls
no test coverage detected