[Second]Maximum Depth of Binary Tree

递归

    int maxDepth(TreeNode *root) {
        // Start typing your C/C++ solution below
        // DO NOT write int main() function
        if(!root)
            return 0;
        int ld = maxDepth(root->left);
        int rd = maxDepth(root->right);
        return max(ld+1,rd+1);
        
    }

  

posted @ 2013-09-29 10:46  summer_zhou  阅读(125)  评论(0编辑  收藏  举报