剑指OFFER----二叉树的深度(js实现)

function TreeDepth(pRoot) {
    if(pRoot === null) {
        return 0;
    } 
    var left = 1 + TreeDepth(pRoot.left);
    var right = 1 + TreeDepth(pRoot.right);
    return Math.max(left, right);
}
点赞