C++代码:
if(root==NULL)
{
return 0;
}
int l=maxDepth(root->left)+1;
int r=maxDepth(root->right)+1;
return l>r?l:r;
递归
C++代码:
if(root==NULL)
{
return 0;
}
int l=maxDepth(root->left)+1;
int r=maxDepth(root->right)+1;
return l>r?l:r;
递归