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