题目链接 101. 对称二叉树
bool isSameTree(struct TreeNode* p, struct TreeNode* q) {if (p != NULL && q != NULL) {return p->val == q->val // 根与根&& isSameTree(p->left, q->right) // 左与右&& isSameTree(p->right, q->left); // 右与左} else if (p == NULL && q == NULL) {return true;} else {return false;}
}bool isSymmetric(struct TreeNode* root) {// 分解比较return isSameTree(root->left, root->right);
}