二叉树的最大深度

我终于也可以,超简洁代码AC了!!!

https://leetcode-cn.com/problems/maximum-depth-of-binary-tree/

1 int maxDepth(TreeNode* root) {
2         if(root==NULL)
3             return 0;
4         return max(maxDepth(root->left)+1,maxDepth(root->right)+1);
5     }
View Code
原文地址:https://www.cnblogs.com/hcl6/p/14023462.html