bool MyisSymmetric(struct TreeNode* Left,struct TreeNode* Right) { if(!Left&&!Right) return true; if(!Left||!Right) return false; if(Right->val!=Left->val) return false; return MyisSymmetric(Left->left,Right->right)&&MyisSymmetric(Left->right,Right->left); } bool isSymmetric(struct TreeNode* root) { if(root==NULL) return true; return MyisSymmetric(root->left,root->right); }
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)