Design Add and Search Words Data Structure
A medium-tier problem at 47% community acceptance, tagged with String, Depth-First Search, Design. Reported in interviews at Docusign and 7 others.
You're staring at a design problem that asks you to build a data structure supporting word insertion and wildcard search. Docusign, DoorDash, LinkedIn, and TikTok all ask this one. The acceptance rate sits at 47%, which means nearly half the candidates who attempt it fail. Most get the basic Trie right but choke on the wildcard logic when a '.' can match any single character. If this problem hits your live assessment and you blank on how to traverse the Trie with backtracking, StealthCoder surfaces a working implementation in seconds, invisible to the proctor.
Companies that ask "Design Add and Search Words Data Structure"
Design Add and Search Words Data Structure is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Made by a working Amazon engineer who got tired of watching qualified friends bomb OAs they'd solve cold in an IDE.
Get StealthCoderThe trap is thinking a standard Trie is enough. You build the insert method cleanly, but search with wildcards demands DFS or recursive backtracking through the Trie. When you hit a '.', you can't just look up one child; you have to try all of them and backtrack if a path fails. Most candidates know Trie structure and understand DFS basics, but the combination under pressure causes them to either skip the wildcard case entirely or write a search that crashes on malformed recursion. The problem sits at the boundary between data structure design and graph traversal, which is why it stings. StealthCoder is the hedge if you've drilled Tries but haven't rehearsed this exact pattern enough to code it clean on the first try.
Pattern tags
You know the problem.
Make sure you actually pass it.
Design Add and Search Words Data Structure recycles across companies for a reason. It's medium-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Made by a working Amazon engineer who got tired of watching qualified friends bomb OAs they'd solve cold in an IDE. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Design Add and Search Words Data Structure interview FAQ
Why does the obvious recursive search fail on wildcards?+
Because a '.' doesn't just match one child node; it matches any child. You have to try all children and backtrack if none of them lead to a valid word. Forgetting the backtracking step or not iterating all children are common mistakes that crash the search or return false positives.
Is this really a medium, or does it feel harder?+
It's medium-hard. The Trie part is straightforward, but the wildcard DFS is where the difficulty lives. At 47% acceptance, it's harder than average mediums. You need both data structure fluency and solid recursion control.
Do I need to optimize for memory or time?+
The problem doesn't specify constraints, so assume a reasonable dictionary size. Trie is memory-efficient compared to a hash set, and the DFS search is acceptable for typical use. Don't over-engineer unless the interviewer asks.
How does this relate to other Trie problems?+
Most Trie problems (autocomplete, spell check) need simple prefix matching. This one adds backtracking on top. If you're solid on basic Trie insertion and DFS, this is the next natural step. LinkedIn and Atlassian both ask it, so it's a known pattern in their stacks.
What's the most common way to fail this live?+
Writing insert correctly but then using a simple loop or single-path lookup for search, forgetting that '.' spawns multiple branches. You build the structure right but underestimate the traversal logic. That gap between design and search is where most OAs break.
Want the actual problem statement? View "Design Add and Search Words Data Structure" on LeetCode →