原题链接:https://leetcode-cn.com/problems/er-cha-shu-de-shen-du-lcof/
dfs
int maxDepth(TreeNode* root) {
if (root == NULL) return 0;
return max(maxDepth(root->left),maxDepth(root->right)) + 1;
}
原题链接:https://leetcode-cn.com/problems/er-cha-shu-de-shen-du-lcof/
dfs
int maxDepth(TreeNode* root) {
if (root == NULL) return 0;
return max(maxDepth(root->left),maxDepth(root->right)) + 1;
}