class Solution {
public:
int TreeDepth(TreeNode* pRoot)
{
if(pRoot==NULL)
return 0;
int l = TreeDepth(pRoot->left);
int r = TreeDepth(pRoot->right);
return l>r?(l+1):(r+1);
}
};
二叉树的深度
最新推荐文章于 2023-09-07 09:37:26 发布