Practice Words Within Two Edits of Dictionary
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
You are given two string arrays, queries and dictionary. All words in each array comprise of lowercase English letters and have the same length. In one edit you can take a word from queries, and change any letter in it to any other letter. Find all words from queries that, after a maximum of two edits, equal some word from dictionary. Return a list of all words from queries, that match with some word from dictionary after a maximum of two edits. Return the words in the same order they appear in queries.
Source: Words Within Two Edits of Dictionary on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
queries = ["word","note","ants","wood"], dictionary = ["wood","joke","moat"]
["word","note","wood"]
# Example 2
queries = ["yes"], dictionary = ["not"]
[]
Constraints
Related LeetCode Problems
Practice more problems similar to Words Within Two Edits of Dictionary.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.