Trie Implementation / Trie-based String Operations

Implement a Trie (prefix tree) for a set of words containing only lowercase English letters.

Implement the APIs:

  • insert(word: str) -> None
  • search(word: str) -> bool
  • `startsWith(prefix: str)...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: