标签:str col max tree dep 路径 root div ret
时间限制:1秒 空间限制:32768K
/* struct TreeNode { int val; struct TreeNode *left; struct TreeNode *right; TreeNode(int x) : val(x), left(NULL), right(NULL) { } };*/ class Solution { public: int TreeDepth(TreeNode* pRoot) { if(!pRoot) return 0; int leftDepth=TreeDepth(pRoot->left); int rightDepth=TreeDepth(pRoot->right); int Depth=max(leftDepth,rightDepth); return(Depth+1); } };
标签:str col max tree dep 路径 root div ret
原文地址:https://www.cnblogs.com/luyalin/p/9083798.html