|
5 | 5 | import java.util.Map;
|
6 | 6 | import java.util.Set;
|
7 | 7 |
|
8 |
| -/** |
9 |
| - * 966. Vowel Spellchecker |
10 |
| - * |
11 |
| - * Given a wordlist, we want to implement a spellchecker that converts a query word into a correct word. |
12 |
| - * |
13 |
| - * For a given query word, the spell checker handles two categories of spelling mistakes: |
14 |
| - * |
15 |
| - * Capitalization: If the query matches a word in the wordlist (case-insensitive), then the query word is returned with |
16 |
| - * the same case as the case in the wordlist. |
17 |
| - * Example: wordlist = ["yellow"], query = "YellOw": correct = "yellow" |
18 |
| - * Example: wordlist = ["Yellow"], query = "yellow": correct = "Yellow" |
19 |
| - * Example: wordlist = ["yellow"], query = "yellow": correct = "yellow" |
20 |
| - * |
21 |
| - * Vowel Errors: If after replacing the vowels ('a', 'e', 'i', 'o', 'u') of the query word with any vowel individually, |
22 |
| - * it matches a word in the wordlist (case-insensitive), then the query word is returned with the same case as the |
23 |
| - * match in the wordlist. |
24 |
| - * Example: wordlist = ["YellOw"], query = "yollow": correct = "YellOw" |
25 |
| - * Example: wordlist = ["YellOw"], query = "yeellow": correct = "" (no match) |
26 |
| - * Example: wordlist = ["YellOw"], query = "yllw": correct = "" (no match) |
27 |
| - * |
28 |
| - * In addition, the spell checker operates under the following precedence rules: |
29 |
| - * |
30 |
| - * When the query exactly matches a word in the wordlist (case-sensitive), you should return the same word back. |
31 |
| - * When the query matches a word up to capitlization, you should return the first such match in the wordlist. |
32 |
| - * When the query matches a word up to vowel errors, you should return the first such match in the wordlist. |
33 |
| - * If the query has no matches in the wordlist, you should return the empty string. |
34 |
| - * |
35 |
| - * Given some queries, return a list of words answer, where answer[i] is the correct word for query = queries[i]. |
36 |
| - * |
37 |
| - * Example 1: |
38 |
| - * |
39 |
| - * Input: wordlist = ["KiTe","kite","hare","Hare"], queries = ["kite","Kite","KiTe","Hare","HARE","Hear","hear","keti","keet","keto"] |
40 |
| - * Output: ["kite","KiTe","KiTe","Hare","hare","","","KiTe","","KiTe"] |
41 |
| - * |
42 |
| - * Note: |
43 |
| - * |
44 |
| - * 1 <= wordlist.length <= 5000 |
45 |
| - * 1 <= queries.length <= 5000 |
46 |
| - * 1 <= wordlist[i].length <= 7 |
47 |
| - * 1 <= queries[i].length <= 7 |
48 |
| - * All strings in wordlist and queries consist only of english letters. |
49 |
| - * |
50 |
| - * */ |
51 |
| - |
52 | 8 | public class _966 {
|
53 | 9 |
|
54 | 10 | public static class Solution1 {
|
|
0 commit comments