FastPrepWildcard Address-Book Queries
Problems/Wildcard Address-Book Queries

Wildcard Address-Book Queries

Google logoGoogle● MediumNEW GRADPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report gives exact address fields and four query examples that use None as a wildcard. Here None is written as * in the string matrix, and matching is case-sensitive. Our version is about 94% the same as the reported question.

Each address is a four-string row [streetNumber,street,city,state]. For every query with the same four fields, a field equal to * is a wildcard; every other field must match exactly.

Return one boolean per query indicating whether at least one stored address matches. Comparisons are case-sensitive.

Function

queryAddressBook(addresses: String[][], queries: String[][]) → boolean[]

Examples

Example 1

addresses = [["1","Main","San Jose","CA"],["1","Main","Austin","TX"]]queries = [["1","Main","San Jose","CA"],["1","Main","San Jose","*"],["1","Main","*","*"],["22","Main","San Jose","CA"]]return = [true,true,true,false]

This reproduces the four source query outcomes, with * representing None.

Example 2

addresses = [["10","Oak","Portland","OR"]]queries = [["*","*","*","*"],["10","Oak","Portland","WA"]]return = [true,false]

The all-wildcard query matches any address; the wrong state does not.

Example 3

addresses = []queries = [["*","*","*","*"]]return = [false]

No query matches an empty address book.

Constraints

  • 0 <= addresses.length, queries.length <= 200000.
  • Every row contains exactly four nonempty strings; stored address fields never equal *.

More Google Phone Screen questions

  • Route Pattern MatcherPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Periodic-Color Binary Forest RootsPHONE SCREEN · Seen Nov 2026
  • Evaluate a Nested Math ExpressionPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Best Stock Trade with Buy and Sell DaysPHONE SCREEN · Seen Nov 2026
  • Word Chain Jumps in a GridPHONE SCREEN · Seen Nov 2026
  • Dice-Walk Winning ProbabilityPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Lowest Common Ancestor in an N-ary TreePHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Apartment Housemate PreferencesPHONE SCREEN · Seen Nov 2026
  • Price at Query TimestampsPHONE SCREEN · Seen Nov 2026
  • Course Schedule Cycle DetectionPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026

Similar questions at other companies

  • Find the Unpaired NumbersAdobe · PHONE SCREENAdobe interview questions
  • Find the Unique Element Among PairsChubb · PHONE SCREENChubb interview questions
  • Count Subarrays with a Perfect-Square ProductMicrosoft · OAMicrosoft interview questions
  • Bitwise XOR SubsequencesJP Morgan Chase · OAJP Morgan Chase interview questions
  • Count Valid Bitwise PairsStripe · OAStripe interview questions
  • Bitwise XOR SubsequencesGoldman Sachs · OAGoldman Sachs interview questions
  • Count Subarrays With Given XORInMobi · OAInMobi interview questions
  • Optimize Discount Selection Under a Point BudgetPalantir · OAPalantir interview questions
  • Palindrome-Rearrangeable PairsExpedia · OAExpedia interview questions
  • Top K Frequent ElementsAmazon · OA · PHONE SCREEN · ONSITE INTERVIEW

Google interview experiences

  • Google interviews · November 2026
  • Google Software Engineer Onsite Questions: 10 Experiences
  • Google OA: What It Tests (2026)
  • Google L4 SWE Phone Screen: 1 Experience
  • Google ML Engineering Manager Onsite: 1 Experience
  • Google Experienced SWE First Round and Onsite: 1 Experience
All Google interview questionsSee Google hiring insights
Saved
class Solution {
    public boolean[] queryAddressBook(String[][] addresses, String[][] queries) {
        // Write your code here.
    }
}
Checking account…