/*
struct TreeNode {
int val;
struct TreeNode *left;
struct TreeNode *right;
TreeNode(int x) :
val(x), left(NULL), right(NULL) {
}
};
*/
class Solution {
public:
bool isSymmetrical(TreeNode* pRoot) {
bool res = panduan(pRoot, pRoot);
return res;
}
bool panduan(TreeNode* p, TreeNode* q){
if(p == nullptr && q == nullptr){
return true;
}
if(p == nullptr || q == nullptr){
return false;
}
if(p->val != q->val){
return false;
}
bool a = panduan(p->left, q->right);
bool b = panduan(p->right, q->left);
return a && b;
}
};