PracHub
QuestionsPremiumLearningGuidesInterview PrepNEWCoaches
|Home/Coding & Algorithms/Trexquant

Implement Trie search with wildcard matching

Last updated: Mar 29, 2026

Quick Overview

This question evaluates understanding of trie data structures, string pattern matching with wildcard characters, and efficient algorithm design for large-scale add/search operations.

  • medium
  • Trexquant
  • Coding & Algorithms
  • Software Engineer

Implement Trie search with wildcard matching

Company: Trexquant

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Onsite

Design a text dictionary using a Trie. Support the following operations: - `addWord(word)`: Insert a lowercase English word. - `search(pattern)`: Return `true` if any previously added word matches `pattern`. The `pattern` may contain the wildcard character `.` which matches **exactly one** lowercase letter. (All other characters match themselves.) ### Inputs/Outputs You may implement a class with these two methods, or write functions that process a sequence of operations. ### Constraints - Number of operations up to ~10^5. - Word/pattern length up to ~10^3 (assume typical interview constraints; optimize beyond naive scanning). - Must be implemented in C++.

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.

Related Interview Questions

  • Maintain median of a data stream - Trexquant (medium)
Trexquant logo
Trexquant
Sep 1, 2025, 12:00 AM
Software Engineer
Onsite
Coding & Algorithms
3
0

Design a text dictionary using a Trie.

Support the following operations:

  • addWord(word) : Insert a lowercase English word.
  • search(pattern) : Return true if any previously added word matches pattern .

The pattern may contain the wildcard character . which matches exactly one lowercase letter. (All other characters match themselves.)

Inputs/Outputs

You may implement a class with these two methods, or write functions that process a sequence of operations.

Constraints

  • Number of operations up to ~10^5.
  • Word/pattern length up to ~10^3 (assume typical interview constraints; optimize beyond naive scanning).
  • Must be implemented in C++.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Trexquant•More Software Engineer•Trexquant Software Engineer•Trexquant Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.