Implement Trie search with wildcard matching
Company: Trexquant
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Onsite
Quick Answer: This question evaluates understanding of trie data structures, string pattern matching with wildcard characters, and efficient algorithm design for large-scale add/search operations.
Constraints
- Words are lowercase English strings
Examples
Input: ([['add', 'bad'], ['add', 'dad'], ['add', 'mad'], ['search', 'pad'], ['search', 'bad'], ['search', '.ad'], ['search', 'b..']],)
Expected Output: [False, True, True, True]
Input: ([['search', '.'], ['add', 'a'], ['search', '.'], ['search', '..']],)
Expected Output: [False, True, False]
Hints
- DFS branches only when the pattern character is a wildcard.