class Solution {
public:
bool dfs(TreeNode* l,TreeNode* r)
{
if(l==NULL&&r==NULL)
return true;
else if(l&&r)
return l->val==r->val&&dfs(l->left,r->right)&&dfs(l->right,r->left);
return false;
}
bool isSymmetric(TreeNode* root) {
if(!root) return true;
return dfs(root->left,root->right);
}
};
标签:right,return,TreeNode,dfs,二叉树,&&,对称,root
From: https://www.cnblogs.com/tangxibomb/p/17266422.html