Easy C++ Solution|| DFS || Beats 100% ✔✔ || Explanation ✔✔
Approach\n Describe your approach to solving the problem. \n1. Do preorder traversal in the left subtree (node-left-right) and preorder traversal in reverse man
# Approach\n<!-- Describe your approach to solving the problem. -->\n1. Do preorder traversal in the left subtree (node-left-right) and preorder traversal in reverse manner (node-right-left) in the right subtree. \n2. At any point, if we find any dissimilarity then the tree is not symmetric, otherwise it is symmetric.\n\n# Complexity\n- Time complexity:\n    O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n\n- Space complexity:\n  O(h)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n\n# Code\n```\nclass Solution {\npublic:\n    bool check(TreeNode *root1, TreeNode *root2){\n        if(root1==NULL && root2==NULL) return true;\n        if(!(root1 && root2)) return false;\n\n        if(root1->val!=root2->val) return false;\n        bool l=check(root1->left,root2->right);\n        bool r=check(root1->right,root2->left);\n        return l&&r;\n    }\n    bool isSymmetric(TreeNode* root) {\n        return check(root->left,root->right);\n\n    }\n};\n```
['C++']