题目链接:https://www.nowcoder.com/practice/8a2b2bf6c19b4f23a9bdb9b233eefa73?tpId=196&rp=1&ru=%2Fexam%2Foj&qru=%2Fexam%2Foj&sourceUrl=%2Fexam%2Foj%3Fpage%3D2%26tab%3D%25E7%25AE%2597%25E6%25B3%2595%25E7%25AF%2587%26topicId%3D196&difficulty=&judgeStatus=&tags=&title=13&gioEnter=menu
题目如下:
class Solution {
public:
int maxDepth(TreeNode* root) {
if(!root) return 0;
return dfs(root);
}
int dfs(TreeNode* root){
if(!root) return 0;
int L=dfs(root->left);
int R=dfs(root->right);
return max(L,R)+1;
}
};



