leetcode 104 Maximum Depth of Binary Tree

int maxDepth(TreeNode* root) {
    if (!root == NULL)
        return 0;
    
    return max(maxDepth(root->left), maxDepth(root->right)) + 1;
}

 

posted on 2018-01-24 00:34  willaty  阅读(80)  评论(0)    收藏  举报

导航