Python Solution with EASY Explanation
Please Upvote if it helps ! \n\n---\n\n- # Intuition\n Describe your first thoughts on how to solve this problem. \n\nTo check whether a tree is mirror symmetri
> # *Please Upvote if it helps !* \n\n---\n\n- # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\nTo check whether a tree is mirror symmetric or not, we need to compare the left and right subtrees of each node. If they are mirror images of each other, then the tree is mirror symmetric.\n\n- # Approach\n<!-- Describe your approach to solving the problem. -->\n\nIn this code, we first check if the root of the tree is None, in which case we return True because an empty tree is mirror symmetric.\n\nThen, we define a helper function called `isMirror` which takes two nodes as input and checks whether they are mirror images of each other. If both nodes are None, we return True. If one of them is None, we return False because a node cannot be a mirror image of None. \n\nOtherwise, we check if the values of the nodes are equal and then recursively check whether the left subtree of the first node is a mirror image of the right subtree of the second node, and whether the right subtree of the first node is a mirror image of the left subtree of the second node.\n\nFinally, we call the `isMirror` function with the left and right subtrees of the root node and return the result. If the tree is mirror symmetric, the function will return True, otherwise it will return False.\n\n- # Code\n\nHere is the  `Python` code to check whether a tree is mirror symmetric or not:\n\n```\n\nclass Solution:\n    def isSymmetric(self, root: TreeNode) -> bool:\n        def isMirror(t1, t2):\n            if not t1 and not t2:\n                return True\n            if not t1 or not t2:\n                return False\n            return t1.val == t2.val and isMirror(t1.right, t2.left) and isMirror(t1.left, t2.right)\n        \n        return isMirror(root, root)\n```\n
['Python3']