class Solution {
public:
bool isSymmetric(TreeNode* root) {
if(!root) return true;
return isSymmetric(root->left,root->right);
}
bool isSymmetric(TreeNode* root1,TreeNode* root2) {
if(!root1 || !root2) return root1==root2;
return root1->val == root2->val ? isSymmetric(root1->left,root2->right) && isSymmetric(root1->right,root2->left) : false;
}
};
public:
bool isSymmetric(TreeNode* root) {
if(!root) return true;
return isSymmetric(root->left,root->right);
}
bool isSymmetric(TreeNode* root1,TreeNode* root2) {
if(!root1 || !root2) return root1==root2;
return root1->val == root2->val ? isSymmetric(root1->left,root2->right) && isSymmetric(root1->right,root2->left) : false;
}
};