Symmetric Tree Solution in C++
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\nO(n)\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\nO(1)\n# Code\n```\n/**\n * Definition for a binary tree node.\n * struct TreeNode {\n *     int val;\n *     TreeNode *left;\n *     TreeNode *right;\n *     TreeNode() : val(0), left(nullptr), right(nullptr) {}\n *     TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}\n *     TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {}\n * };\n */\nclass Solution {\npublic:\n    bool check(TreeNode* root1, TreeNode* root2)\n    {\n        if(root1==NULL && root2==NULL)\n            return true;\n        if(root1==NULL || root2==NULL)\n            return false;\n        if(root1->val==root2->val)\n            return check(root1->left, root2->right) && check(root1->right, root2->left);\n        return false;\n    }\n    bool isSymmetric(TreeNode* root) {\n        return check(root->left, root->right);\n    }\n};\n```\n![upvote new.jpg](https://assets.leetcode.com/users/images/21243a90-9cb4-4904-acec-45e72bc6ede1_1692455011.561149.jpeg)\n
['C++']