【leetcode】二叉树的深度

int maxDepth(struct TreeNode* root){
    if (root == NULL) {
        return 0;
    }

    int lenLeft = maxDepth(root->left) + 1;
    int lenRight = maxDepth(root->right) + 1;

    return lenLeft > lenRight ? lenLeft : lenRight;
}
原文地址:https://www.cnblogs.com/ganxiang/p/13552070.html