104:Maximum Depth of Binary Tree【树】【DFS】

来源:互联网 发布:烟台网络党校下载 编辑:程序博客网 时间:2024/06/06 04:27

题目链接:click~

/*题意:求二叉树的深度*/class Solution {public:    int maxDepth(TreeNode *root) {        if(root == NULL) return 0;        return max(maxDepth(root->left), maxDepth(root->right)) + 1;    }};


0 0
原创粉丝点击