面试必考精华版Leetcode104. 二叉树的最大深度
题目:
代码(首刷自解 day23):
class Solution {
public:int maxDepth(TreeNode* root) {if(root==nullptr) return 0;return max(maxDepth(root->left),maxDepth(root->right))+1;}
};
class Solution {
public:int maxDepth(TreeNode* root) {if(root==nullptr) return 0;return max(maxDepth(root->left),maxDepth(root->right))+1;}
};