#966

Vowel Spellchecker

specialist · 760 · lc medium +31 · verified · 61.4% accepted · 851 likes · top 61%

Description

Given a wordlist and a list of queries, correct each query by these priority rules: return it unchanged if it exactly matches a word; return the first case-insensitive match; return the first word that matches after treating all vowels as wildcards (case-insensitive); or return "" if no match is found.

Example 1:

Input: wordlist = ["KiTe","kite","hare","Hare"], queries = ["kite","Kite","KiTe","Hare","HARE","Hear","hear","keti","keet","keto"]
Output: ["kite","KiTe","KiTe","Hare","hare","","","KiTe","","KiTe"]

Example 2:

Input: wordlist = ["yellow"], queries = ["YellOw"]
Output: ["yellow"]

Code

1
2
3