SOURCE

// 二叉树---对称二叉树
// 判断是否是对称二叉树

function check(leftPart, rightPart){
    if(!leftPart && !rightPart) return true
    if(!leftPart || !rightPart) return false
    var result = 
    leftPart.val === rightPart.val &&
    check(leftPart.left, rightPart.right) &&
    check(leftPart.right, rightPart.left)
} 

function isduichen(root){
    return check(root, root)
}
console 命令行工具 X clear

                    
>
console