/**
* struct TreeNode {
* int val;
* struct TreeNode *left;
* struct TreeNode *right;
* };
*/
/**
* 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
*
*
* @param root TreeNode类
* @return bool布尔型
*/
#include <stdbool.h>
bool dfs(struct TreeNode* root1, struct TreeNode* root2) {
if (!root1 && !root2) return true;
if (!root1 && root2) return false;
if (root1 && !root2) return false;
if (root1->val != root2->val) return false;
return dfs(root1->left, root2->right) && dfs(root1->right, root2->left);
}
bool isSymmetric(struct TreeNode* root ) {
return dfs(root, root);
}