leetcode 104 Maximum Depth of Binary Tree
int maxDepth(TreeNode* root) { if (!root == NULL) return 0; return max(maxDepth(root->left), maxDepth(root->right)) + 1; }
【本文章出自博客园willaty,转载请注明作者出处,误差欢迎指出~】
int maxDepth(TreeNode* root) { if (!root == NULL) return 0; return max(maxDepth(root->left), maxDepth(root->right)) + 1; }