二叉树的遍历
代码:
1 int maxDepth(TreeNode *root) { 2 if (!root) 3 return 0; 4 return max(maxDepth(root->left), maxDepth(root->right)) + 1; 5 }
二叉树的遍历
代码:
1 int maxDepth(TreeNode *root) { 2 if (!root) 3 return 0; 4 return max(maxDepth(root->left), maxDepth(root->right)) + 1; 5 }
转载于:https://www.cnblogs.com/boring09/p/4267251.html