class Solution {
public:
int DFS(TreeNode* root, int ans){
if(!root) return ans;
ans++;
return max(DFS(root->left, ans), DFS(root->right, ans));
}
int maxDepth(TreeNode* root) {
return DFS(root, 0);
}
};