class Solution { public: int Tree(TreeNode* pRoot) { if(pRoot==NULL) return 0; if(pRoot->left==NULL&&pRoot->right==NULL) return 1; int dep=0; return Tree(pRoot->left)>Tree(pRoot->right)? Tree(pRoot->left)+1:Tree(pRoot->right)+1; } int TreeDepth(TreeNode* pRoot) { if(pRoot==NULL) return 0; return Tree(pRoot); } };