力扣递归方法判断对称二叉树
先判断根节点,再判断左右节点
//
/**
* Definition for a binary tree node.
* function TreeNode(val, left, right) {
* this.val = (val===undefined ? 0 : val)
* this.left = (left===undefined ? null : left)
* this.right = (right===undefined ? null : right)
* }
*/
/**
* @param {TreeNode} root
* @return {boolean}
*/
var isSymmetric = function(root) {
if(root==null) return true;
return issym(root.left,root.right)
};
function issym(left,right){
if (left==null & right==null) return true
if (left==null || right== null) return false
return(left.val==right.val) && issym(left.left,right.right) && issym(left.right,right.left)
};