二叉树的深度

来源:互联网 发布:金融量化分析师 知乎 编辑:程序博客网 时间:2024/05/29 06:42
class Solution {public:    int TreeDepth(TreeNode* pRoot)    {        if(!pRoot)            return 0;        return max(TreeDepth(pRoot->left),TreeDepth(pRoot->right))+1;        }};

0 0
原创粉丝点击