题目
Implement a trie with insert
, search
, and startsWith
methods.
Example:
1 | Trie trie = new Trie(); |
Note:
- You may assume that all inputs are consist of lowercase letters
a-z
. - All inputs are guaranteed to be non-empty strings.
思路
字典树。
代码
1 | class Node(object): |