二叉树的深度 codelover 2020-09-06 113 阅读1分钟 很简单的代码,但未必会想到 class Solution {public: int maxDepth(TreeNode* root) { if(root==NULL) return 0; return max(maxDepth( root->left),maxDepth( root->right))+1; }};