Leetcode#104 Maximum Depth of Binary Tree

原题地址

 

二叉树的遍历

 

代码:

1 int maxDepth(TreeNode *root) {
2         if (!root)
3             return 0;
4         return max(maxDepth(root->left), maxDepth(root->right)) + 1;
5 }

 

posted @ 2015-02-02 11:11  李舜阳  阅读(123)  评论(0编辑  收藏  举报