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;
}
};
本文标题:maximum-depth-of-binary-tree
本文链接:https://www.haomeiwen.com/subject/uxlitctx.html
网友评论