maximum-depth-of-binary-tree
2019-05-31 本文已影响0人
DaiMorph
class Solution {
public:
int maxDepth(TreeNode *root) {
if(root==NULL)return 0;
return max(maxDepth(root->left),maxDepth(root->right))+1;
}
};
class Solution {
public:
int maxDepth(TreeNode *root) {
if(root==NULL)return 0;
return max(maxDepth(root->left),maxDepth(root->right))+1;
}
};