Skip to content

Latest commit

 

History

History
47 lines (29 loc) · 1.07 KB

0208-implement-trie-prefix-tree.adoc

File metadata and controls

47 lines (29 loc) · 1.07 KB

208. Implement Trie (Prefix Tree)

{leetcode}/problems/implement-trie-prefix-tree/[LeetCode - Implement Trie (Prefix Tree)^]

没想到 Trie Tree 实现起来一点也不复杂!

思考题:如何实现一个工业级的 Trie Tree?

{image_attr}

参考资料

Implement a trie with insert, search, and startsWith methods.

Example:

Trie trie = new Trie();

trie.insert("apple");
trie.search("apple");   // returns true
trie.search("app");     // returns false
trie.startsWith("app"); // returns true
trie.insert("app");
trie.search("app");     // returns true

Note:

  • You may assume that all inputs are consist of lowercase letters a-z.

  • All inputs are guaranteed to be non-empty strings.

link:{sourcedir}/_0208_ImplementTriePrefixTree.java[role=include]