python solution || hash with dict || faster than 60% || time: O(nk) || space: O(nk)
\tclass MagicDictionary:\n\n\t\tdef init(self):\n\t\t\tself.magic_dict = dict() \n\n\t\tdef buildDict(self, dictionary: List[str]) -> None:\n\t\t\tfor word in d
\tclass MagicDictionary:\n\n\t\tdef __init__(self):\n\t\t\tself.magic_dict = dict() \n\n\t\tdef buildDict(self, dictionary: List[str]) -> None:\n\t\t\tfor word in dictionary: \n\t\t\t\tword_len = len(word)\n\t\t\t\tfor i in range(word_len): \n\t\t\t\t\tkey = word[:i] + \'*\' + word[i+1:]\n\t\t\t\t\tif key not in self.magic_dict: \n\t\t\t\t\t\tself.magic_dict[key] = set()\n\t\t\t\t\t\tself.magic_dict[key].add(word[i])\n\t\t\t\t\telif key in self.magic_dict: \n\t\t\t\t\t\tself.magic_dict[key].add(word[i])\n\n\t\tdef search(self, searchWord: str) -> bool:\n\t\t\tsearch_word_len = len(searchWord)\n\t\t\tfor i in range(search_word_len): \n\t\t\t\tsearch_string = searchWord[:i] + \'*\' + searchWord[i+1:]\n\t\t\t\tif search_string in self.magic_dict:\n\t\t\t\t\tif len(self.magic_dict[search_string]) == 1 and searchWord[i] not in self.magic_dict[search_string]:\n\t\t\t\t\t\treturn True\n\t\t\t\t\telif len(self.magic_dict[search_string]) >= 2: \n\t\t\t\t\t\treturn True\n\t\t\treturn False    \n\n\t# Your MagicDictionary object will be instantiated and called as such:\n\t# obj = MagicDictionary()\n\t# obj.buildDict(dictionary)\n\t# param_2 = obj.search(searchWord)
[]