class Solution { public: /** * * @param root TreeNode类 * @return int整型 */ int maxDepth(TreeNode* root) { // write code here if(root == NULL) return 0; return 1+max(maxDepth(root->left), maxDepth(root->right)); } };
class Solution { public: /** * * @param root TreeNode类 * @return int整型 */ int maxDepth(TreeNode* root) { // write code here if(root == NULL) return 0; return 1+max(maxDepth(root->left), maxDepth(root->right)); } };