Fuzzy Word Lookup With One Misspelled Letter
Updated
Problem statement
You are given a list of words dictionary and a list of words queries. A query may have one misspelled letter. For each query, decide whether it matches a word in dictionary.
A query matches a word when both have the same length and differ in at most one position. An exact match counts. Inserting or deleting a letter changes the length, so a query of a different length never matches.
Return a boolean array answer where answer[j] is true if queries[j] matches at least one word in dictionary, and false otherwise.
Try to answer each query without comparing it with every word in dictionary.
Function
fuzzyLookup(dictionary: List<String>, queries: List<String>) → boolean[]Examples
Example 1
dictionary = ["apple","apply","banana","grape"]queries = ["appla","banana","grope","bananas","aplpe"]return = [true,true,true,false,false]"appla" differs from "apple" only in the last letter, "banana" is in the dictionary, and "grope" differs from "grape" only in the third letter. No dictionary word has seven letters, so "bananas" has no match. "aplpe" differs from "apple" in two positions and from "apply" in three.
Example 2
dictionary = ["cat"]queries = ["cut","cat","dog","ca"]return = [true,true,false,false]"cut" has one wrong letter and "cat" has none, so both match. "dog" differs in all three positions, and "ca" is shorter than "cat".
Example 3
dictionary = ["mind","bond"]queries = ["bint","bind"]return = [false,true]"bint" differs from "mind" in the first and last letters and from "bond" in the second and last letters, so it needs two fixes against either word. "bind" differs from "mind" only in the first letter.
Constraints
1 <= dictionary.length <= 5 * 10^31 <= queries.length <= 18001 <= dictionary[i].length, queries[j].length <= 20dictionary[i]andqueries[j]consist of lowercase English letters.- Words may repeat in
dictionaryand inqueries.
More Meta Phone Screen questions
- Multi-Head Attention Forward PassPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Run-Length Encoded Vector Dot ProductPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Mutual-Friend RecommendationsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Best Time to Buy and Sell StockPHONE SCREEN · Seen Nov 2026
- First Element Greater Than KPHONE SCREEN · Seen Nov 2026
- Count Events in Rolling Minute WindowsPHONE SCREEN · Seen Oct 2026
- Valid Word AbbreviationPHONE SCREEN · Seen Oct 2026
- Shortest Path in a Binary MatrixPHONE SCREEN · Seen Sep 2026
- Deterministic K-Means AssignmentsPHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026
- Values Exclusive to the Current UserPHONE SCREEN · Seen Sep 2026
Similar questions at other companies
- Design File SystemGoogle · PHONE SCREENGoogle interview questions
- Maximum Move ScoreAmazon · PHONE SCREEN
- Detect Blocked Chat PhrasesWhatNot · PHONE SCREEN · ONSITE INTERVIEWWhatNot interview questions
- Phrase Covering the Most WordsZip · PHONE SCREENZip interview questions
- Indexed API Field Pattern QueriesStripe · PHONE SCREENStripe interview questions
- Find Repeated Substrings Ignoring CaseDatadog · PHONE SCREENDatadog interview questions
- Common Words from Two ReadersAkuna Capital · PHONE SCREENAkuna Capital interview questions
- Design a File System with PathsAirbnb · PHONE SCREENAirbnb interview questions
- Highlight and Rank Overlapping CitationsHarvey · PHONE SCREEN · ONSITE INTERVIEWHarvey interview questions
- Word Break IIWex · PHONE SCREEN
Meta interview experiences
- Meta PhD SWE Intern AI Coding Phone Screen: 1 Experience
- Meta Business Support Engineer Phone Screen: 1 Experience
- Meta Software Engineer Onsite Questions: 3 Experiences
- Meta AI Native Engineer OA and Onsite: 1 Experience
- Meta AI-Native Coding Interview: 3 Experiences
- Meta Production Engineer Intern Questions: 6 Experiences