public class TreeNode {
    int val = 0;
    TreeNode left = null;
    TreeNode right = null;

    public TreeNode(int val) {
        this.val = val;

    }

}
*/
public class Solution {
    boolean isSymmetrical(TreeNode pRoot) {
        if(pRoot == null){
            return true;
        }
        return isSame(pRoot.left, pRoot.right);
    }
    boolean isSame(TreeNode node1,TreeNode node2){
        if(node1 == null  &&node2 == null){
            return true;
        }
        if(node1 == null || node2 == null){
            return false;
        }
        if(node1.val == node2.val){
            return isSame(node1.left, node2.right) &&isSame(node1.right, node2.left);
        }
        return false;
    }
}