367. Words Within Two Edits of Dictionary
MediumString
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.
Examples
Input: ["word","note","ants","wood"] ["wood","joke","moat"]
Output: ["word","note","wood"]
Explanation: Public test case for Words Within Two Edits of Dictionary
Constraints
- 1 <= queries.length, dictionary.length <= 100
- n == queries[i].length == dictionary[j].length
- 1 <= n <= 100
- All queries[i] and dictionary[j] are composed of lowercase English letters.
Loading...
Run checks all cases above. Submit evaluates all test cases.