(self, word: str)
| 21 | node.is_word = True |
| 22 | |
| 23 | def search(self, word: str) -> bool: |
| 24 | node = self.root |
| 25 | for c in word: |
| 26 | # For each character in the word, if it's not a child of |
| 27 | # the current node, the word doesn't exist in the Trie. |
| 28 | if c not in node.children: |
| 29 | return False |
| 30 | node = node.children[c] |
| 31 | # Return whether the current node is marked as the end of the |
| 32 | # word. |
| 33 | return node.is_word |
| 34 | |
| 35 | def has_prefix(self, prefix: str) -> bool: |
| 36 | node = self.root |
nothing calls this directly
no outgoing calls
no test coverage detected