原题地址

 

二叉树的遍历

 

代码:

1 int maxDepth(TreeNode *root) {
2         if (!root)
3             return 0;
4         return max(maxDepth(root->left), maxDepth(root->right)) + 1;
5 }

 

相关文章:

  • 2021-08-14
  • 2021-05-19
  • 2022-12-23
  • 2022-01-10
猜你喜欢
  • 2021-05-02
  • 2021-12-10
  • 2021-09-07
  • 2021-06-05
  • 2021-07-22
  • 2022-12-23
  • 2021-09-23
相关资源
相似解决方案