Implement the data structure with wildcard support. core ideas: - addWord is identical to standard trie insert - search needs DFS to handle wildcards - Early termination: if any branch succeeds, return true immediately Edge cases: - Word is all dots: must check all paths of that length - Multiple dots: backtracking explores all combinations - Empty word: check if root is marked as end This pattern.
Trie + DFS for pattern matching. Appears in word puzzles and regular expression engines. Time: . Space: .