FastPrepAdd and Search Words With Wildcards
Problems/Add and Search Words With Wildcards

Add and Search Words With Wildcards

Adobe logoAdobe● MediumFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: This problem builds a word dictionary. You add words, then search with patterns where a dot stands for any single letter, and a match must cover the whole word. An Adobe Computer Scientist 2 report from Noida (posted September 2024, about interviews held that August) opens its first round, on data structures and C++, with a link to the well-known problem about adding and searching words. The rest of that round was C++ questions on polymorphism, virtual tables and memory. The report gives no rules, limits or examples of its own.

We chose the usual rules of that problem: a dot matches exactly one letter, and only whole-word matches count. Calls come as two arrays, and the search results are returned. There are up to 3000 calls, words are 1 to 20 lowercase letters, and a pattern has at most 3 dots. We wrote new examples. Our other Adobe trie problem has add, search and prefix calls without dots, so this is a separate exercise.

Our version is about 85% the same as the reported question.

Build a word dictionary that supports two calls, starting empty:

  • add(word): store word.
  • search(pattern): return true if some stored word matches pattern. A pattern matches a word when both have the same length and, at every position, the pattern has either the same letter or a dot '.', which stands for any one letter.

You get the calls in order: operations[i] is "add" or "search" and words[i] is its word or pattern. Return the results of the search calls, in order. A search only sees words added before it.

Function

runWordDictionary(operations: String[], words: String[]) → boolean[]

Examples

Example 1

operations = ["add","add","search","search","search","search"]words = ["code","cove","co.e","c...","cod","..ve."]return = [true,true,false,false]

co.e matches both code and cove, and c... matches any four-letter word starting with c. cod is only the start of a stored word, so it does not match, and ..ve. has five characters while every stored word has four.

Example 2

operations = ["search","add","search"]words = ["a","a","."]return = [false,true]

The first search runs before anything is stored, so it is false. After a is added, . matches it.

Example 3

operations = ["add","add","add","search","search"]words = ["bat","bad","bed","b.d","..t"]return = [true,true]

b.d matches bad and bed; ..t matches bat.

Constraints

  • 1 <= operations.length <= 3000 and words.length == operations.length
  • Each operations[i] is "add" or "search", and at least one is "search"
  • 1 <= words[i].length <= 20
  • For "add", words[i] has only lowercase English letters; for "search", it has lowercase letters and '.', with at most 3 dots

More Adobe Phone Screen questions

  • Evaluate a Parenthesized Integer ExpressionPHONE SCREEN · Seen Oct 2026
  • All Elements of Two BSTs in OrderPHONE SCREEN · Seen Aug 2026
  • Rotate an Array In PlaceOA · PHONE SCREEN · Seen Aug 2026
  • Binary Tree Level-Order Traversal by LevelsPHONE SCREEN · ONSITE INTERVIEW · Seen Aug 2026
  • Count Occurrences in a Sorted ArrayPHONE SCREEN · ONSITE INTERVIEW · Seen Jul 2026
  • Count Pairs with Absolute Difference KPHONE SCREEN · Seen Jul 2026
  • Count Subsets with Sum KPHONE SCREEN · Seen Jul 2026
  • Numbers with Exactly Three DivisorsPHONE SCREEN · Seen Jul 2026
  • Sum of Even Nodes on a Path in a Numbered Binary TreePHONE SCREEN · Seen Jul 2026
  • Largest Value in Every Sliding WindowPHONE SCREEN · Seen Jul 2026

Similar questions at other companies

  • Word Dictionary with WildcardsDatadog · PHONE SCREENDatadog interview questions
  • Word Dictionary with Wildcard FindAmazon · ONSITE INTERVIEW
  • Design File SystemGoogle · PHONE SCREENGoogle interview questions
  • Prefix Word DictionaryBloomberg LP · PHONE SCREENBloomberg LP interview questions
  • Implement TrieOptiver · PHONE SCREENOptiver interview questions
  • Design Search Autocomplete SystemRoblox · PHONE SCREEN · ONSITE INTERVIEWRoblox interview questions
  • Spreadsheet With Dependent CellsCharacter.AI · PHONE SCREEN
  • Evaluate Live Spreadsheet ExpressionsStrala · PHONE SCREEN
  • Serialize and Deserialize an N-Ary TreeUber · ONSITE INTERVIEWUber interview questions
  • Implement a TrieMicrosoft · ONSITE INTERVIEWMicrosoft interview questions

Interview reports that mention this question

  • Adobe CS2 and Senior CS Interviews: 6 Experiences (Part 5 of 6)
  • Adobe Experienced Hire Interviews: 55 Experiences (Part 1 of 6)

Adobe interview experiences

  • Adobe Web, QA, DevOps, ML Roles: 13 Experiences (Part 3 of 3)
  • Adobe SWE Interviews, Level Unknown: 25 Experiences (Part 2 of 3)
  • Adobe Interviews, Level Unknown: 38 Experiences (Part 1 of 3)
  • Adobe New Grad MTS Interview Questions: 7 Experiences
All Adobe interview questionsSee Adobe hiring insights
Saved
class Solution {
    public boolean[] runWordDictionary(String[] operations, String[] words) {
        // Write your code here.
    }
}
Checking account…