题目

题目链接:
 https://www.lintcode.com/problem/468/description?showListFe=true&page=1&problemTypeId=2&tagIds=371&ordering=id&pageSize=50
思路
递归
Java代码
/*** Definition of TreeNode:* public class TreeNode {*     public int val;*     public TreeNode left, right;*     public TreeNode(int val) {*         this.val = val;*         this.left = this.right = null;*     }* }*/public class Solution {/*** @param root: the root of binary tree.* @return: true if it is a mirror of itself, or false.*/public boolean isSymmetric(TreeNode root) {if(root ==null) return true;return f(root.left,root.right);}public boolean f(TreeNode  a,TreeNode b){if(a==null && b==null) return true;if(a==null || b==null) return false;if(a.val!=b.val) return false;return f(a.left,b.right) && f(a.right,b.left);}
}