题目链接点这里
对二叉树进行递归操作。
/** * Definition for a binary tree node.
* public class TreeNode {
* * public int val;
* * public TreeNode left;
* * public TreeNode right;
* * public TreeNode(int x) { val = x; }
* * }
* */public class Solution {
* public bool IsSymmetric(TreeNode root) {
* bool x=IsSymmetricplus(root,root);
* return x;
* }
* public bool IsSymmetricplus(TreeNode a,TreeNode b){
* if(a==null&&b==null){
* return true;
* }
* else if(a==null||b==null||a.val!=b.val){
* return false;
* }
* else{
* bool r=IsSymmetricplus(a.left,b.right);
* bool l=IsSymmetricplus(a.right,b.left);
* return r&&l;
* }
* }
* }