Python 97.27% speed | Hashmap only | Simple code
For each word, length is the key. For each searchWord, only need to check the words with same length\n\n\nclass MagicDictionary:\n\n    def __init__(self):\n   
For each word, length is the key. For each searchWord, only need to check the words with same length\n\n```\nclass MagicDictionary:\n\n    def __init__(self):\n        self.myDict = defaultdict(set)\n\n    def buildDict(self, dictionary: List[str]) -> None:\n        for word in dictionary:\n            n = len(word)\n            self.myDict[n].add(word)\n\n    def search(self, searchWord: str) -> bool:\n        n = len(searchWord)\n        if n not in self.myDict: return False\n        \n        def diff(word1, word2):\n            count = 0\n            for i in range(len(word1)):\n                if word1[i] != word2[i]:\n                    count += 1 \n                if count > 1:\n                    return count\n            return count\n                        \n        \n        for word in self.myDict[n]:\n            if diff(word, searchWord) == 1:\n                return True\n        return False\n```
['Hash Table', 'Python', 'Python3']