二叉树: 二叉树的最大深度

31 阅读1分钟

image.png

function maxDepth( root ) {
    if(!root) return 0;
    return Math.max(maxDepth(root.left),maxDepth(root.right)) + 1
}