1class Solution {2public:3bool mirror(TreeNode *root1, TreeNode *root2) {4if (root1 == NULL and root2 == NULL) return true;5if (root1 == NULL or root2 == NULL) return false;67if (root1->val != root2->val) return false;89return mirror(root1->left, root2->right) and mirror(root1->right, root2->left);10}1112bool isSymmetric(TreeNode *root) {13if (root == NULL) return true;1415return mirror(root->left, root->right);16}17};