Member Directory Search Supporting Single Character Wildcards

Last updated: November 29, 2026

Quick Overview

Design a structure with add(name) and search(pattern), where the pattern may contain '.' matching any single character, for searching an internal member directory by partially remembered names.

LinkedIn
Coding & Algorithms
Software Engineer
LinkedIn
November 29, 2026
Software Engineer
Technical Screen
Coding & Algorithms
Medium

0

0

0 solved


Design a structure with add(name) and search(pattern), where the pattern may contain '.' matching any single character, for searching an internal member directory by partially remembered names.

A trie question in the style of LinkedIn's technical screens, tied to internal directory search. The interviewer checks trie insertion, DFS branching only on wildcards, and a sense of how worst-case patterns behave.

What the Interviewer Expects
  • Implements a trie with children maps and an end flag
  • Searches exact characters by direct child lookup
  • Branches to all children only on '.'
  • Returns True as soon as a match is found
  • Analyzes the worst case of a pattern of all dots
Key Topics to Cover
trie
DFS
wildcard matching
prefix tree
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • How would you support '*' matching any sequence of characters?
  • How would you index by length to speed up all-wildcard patterns?
  • How would you make search case-insensitive and accent-insensitive?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements

Names are lowercase letters (normalize upstream). add inserts. search(pattern) returns True if any stored name has the same length and matches every non-dot character. Exact matches only, not pref...

High-Level Design

Each trie node holds a dict of children and a boolean end. Insertion walks and creates nodes. Search is a recursive DFS over (node, index): a letter follows one child or fails; a dot tries every c...


Submit Your Answer
Markdown supported