題目
- 208 Implement Trie (Prefix Tree) (Medium)
- 1804 Implement Trie II (Prefix Tree) (Medium, Premium)
- 648 Replace Words (Medium)
- 211 Design Add and Search Words Data Structure (Medium)
- 677 Map Sum Pairs (Medium)
[補充]
139 Word Break (Medium)
140 Word Break II (Hard)
212 Word Search II (Hard)
336 Palindrome Pairs (Hard)
676 Implement Magic Dictionary (Medium)
720 Longest Word in Dictionary (Medium)
觀念
Binary Tree
1
2
3
4class TreeNode{
int val;
TreeNode left, right;
};N-ary Tree
1
2
3
4class TreeNode{
int val;
TreeNode[] children;
};TrieNode
1
2
3
4class TrieNode<V>{
V val = null;
TrieNode<V> [] children = new TrieNode[256];
}
Implement Trie (Prefix Tree)
1 | class TrieNode{ |
implement Trie ans API
1 |
|
Replace Words
1 | class TrieNode{ |
Design Add and Search Words Data Structure 通配符
1 | class TrieNode{ |