2 Solution Beginner Friendly Set and simple array using Zip (Python3)
Approach\n Describe your approach to solving the problem. \n- 1. Array and Zip \n- 2. Set method\n\n# Complexity\n\n-  Array and Zip\n    - Time complexity: O(n
# Approach\n<!-- Describe your approach to solving the problem. -->\n- 1. Array and Zip \n- 2. Set method\n\n# Complexity\n\n-  Array and Zip\n    - Time complexity: O(n * m)\n\n    - Space complexity: O(n + m)\n- Set \n    - Time complexity: O(26M) \n\n    - Space complexity: O(n * m)\n\n# 1. Simple Array and zip method\n```\nclass MagicDictionary:\n\n    def __init__(self):\n        self.dict = []\n\n    def buildDict(self, dictionary: List[str]) -> None:\n        for ch in dictionary:\n            self.dict.append((ch))\n                \n\n    def search(self, searchWord: str) -> bool:\n        for word in self.dict:\n            if len(word) == len(searchWord) and sum(c1 != c2 for c1, c2 in zip(word, searchWord)) == 1:  return True\n        return False\n```\n- explaination of if statement in Search()\n```\nfor word in self.dict:\n    count = 0\n    for c1, c2 in zip(word, searchWord): #if word is \'hello\' and searchWord is \'hhllo\', zip(word, searchWord) would produce ->\n        if c1 != c2:                     #(\'h\', \'h\'), (\'e\', \'h\'), (\'l\', \'l\'), (\'l\', \'l\'), (\'o\', \'o\')\n            count += 1\n\n    if count == 1: return True\n    else: return False\n\n\n```\n\n# 2 . Set method\n```\nclass MagicDictionary:\n\n    def __init__(self):\n        self.words = set()\n\n    def buildDict(self, dictionary: List[str]) -> None:\n        self.words = set(dictionary)\n\n    def search(self, searchWord: str) -> bool:\n        for i in range(len(searchWord)):\n            for char in \'abcdefghijklmnopqrstuvwxyz\':\n                if char == searchWord[i]:\n                    continue\n                replaced_word = searchWord[:i] + char + searchWord[i + 1:]\n                if replaced_word in self.words:\n                    return True\n        return False\n```\n
['Array', 'Hash Table', 'String', 'Design', 'Python3']