递归判断左左-右右、左右-右左即可。

/*
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) {
        if(!pRoot)return true;
        return func(pRoot->left,pRoot->right);
    }
    bool func(TreeNode* left, TreeNode* right) {
        if(!left)return right == nullptr;
        if(!right)return left == nullptr;
        return left->val == right->val && func(left->left, right->right) && func(left->right, right->left);
    }
};