Returns if there is any word in the trie that starts with the given prefix.
(self, prefix: str)
| 36 | return curr.end |
| 37 | |
| 38 | def startsWith(self, prefix: str) -> bool: |
| 39 | """ |
| 40 | Returns if there is any word in the trie that starts with the given prefix. |
| 41 | """ |
| 42 | curr = self.root |
| 43 | for c in prefix: |
| 44 | i = ord(c) - ord("a") |
| 45 | if curr.children[i] is None: |
| 46 | return False |
| 47 | curr = curr.children[i] |
| 48 | return True |
no outgoing calls
no test coverage detected