208. Implement Trie (Prefix Tree)
Last updated
Was this helpful?
Last updated
Was this helpful?
Implement a trie with insert
, search
, and startsWith
methods.
Note:
You may assume that all inputs are consist of lowercase letters a-z
.
All inputs are guaranteed to be non-empty strings.
GeeksforGeeks
YouTube
Input:
["Trie", "insert", "search", "search", "startsWith", "insert", "search"]
[[], ["apple"], ["apple"], ["app"], ["app"], ["app"], ["app"]]
Output:
[null, null, true, false, true, null, true]