/**
* Definition for a binary tree node.
* public class TreeNode {
* int val;
* TreeNode left;
* TreeNode right;
* TreeNode(int x) { val = x; }
* }
*/
class Solution {
public boolean isSymmetric(TreeNode root) {
if(root==null) return true;
return f(root.left,root.right);
}
public boolean f(TreeNode roota,TreeNode rootb){
if(roota==null&&rootb==null) return true;
if(roota==null||rootb==null) return false;
if(roota.val!=rootb.val) return false;
else{
return f(roota.left,rootb.right)&&f(roota.right,rootb.left);
}
}
}