Python Trie Solution
\nclass TrieNode:\n    def __init__(self):\n        self.children = collections.defaultdict(TrieNode)\n        self.isWord = False\n\nclass Trie:\n    def __ini
```\nclass TrieNode:\n    def __init__(self):\n        self.children = collections.defaultdict(TrieNode)\n        self.isWord = False\n\nclass Trie:\n    def __init__(self):\n        self.root = TrieNode()\n        \n    def insert(self,word):\n        node = self.root\n        for w in word:\n            node = node.children[w]\n        node.isWord = True\n    \n    def search(self,word,k,node):\n        if not word:\n            return k == 0 and node.isWord\n        for r in node.children:\n            if r == word[0]:\n                if self.search(word[1:],k,node.children[r]):\n                    return True\n            elif k == 1:\n                if self.search(word[1:],k-1,node.children[r]):\n                    return True\n        return False\n        \nclass MagicDictionary:\n    def __init__(self):\n        self.t = Trie()\n\n    def buildDict(self, dic: List[str]) -> None:\n        for words in dic:\n            self.t.insert(words)\n\n    def search(self, word: str) -> bool:\n        node = self.t.root\n        return self.t.search(word,1,node)\n\n```
[]