Design Add and Search Words Data Structure
mediumSupport addWord and search with wildcard dot matching
Design Add and Search Words Data Structure
Key Insight
Literal characters use one trie child; "." wildcards branch to all children once at that level.
Step 1Add Dictionary Words
Array
bad
0dad
1mad
2HashMap
b:1
d:1
m:1
Insert bad, dad, and mad into the trie.
1 / 3