思路:纯递归。

public class Solution {public int maxDepth(TreeNode root) {if(root==null){return 0;}return Math.max(maxDepth(root.left),maxDepth(root.right))+1;}}

转载于:https://www.cnblogs.com/Machelsky/p/5858586.html

104. Maximum Depth of Binary Tree相关推荐

  1. 【LeetCode 剑指offer刷题】树题4:104 Maximum Depth of Binary Tree

    [LeetCode & 剑指offer 刷题笔记]目录(持续更新中...) 104. Maximum Depth of Binary Tree Given a binary tree, fin ...

  2. LC 104. Maximum Depth of Binary Tree

    1.题意 104. Maximum Depth of Binary Tree Easy 98540 Given a binary tree, find its maximum depth. The m ...

  3. 【LeetCode】104. Maximum Depth of Binary Tree (2 solutions)

    Maximum Depth of Binary Tree  Given a binary tree, find its maximum depth. The maximum depth is the ...

  4. LeetCode: 104. Maximum Depth of Binary Tree

    题目 Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the l ...

  5. Leet Code OJ 104. Maximum Depth of Binary Tree [Difficulty: Easy]

    题目: Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the ...

  6. leetcode 104. Maximum Depth of Binary Tree

    Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the long ...

  7. 【leetcode】104. Maximum Depth of Binary Tree

    1. 题目 Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along th ...

  8. leetcode python3 简单题104. Maximum Depth of Binary Tree

    1.编辑器 我使用的是win10+vscode+leetcode+python3 环境配置参见我的博客: 链接 2.第一百零四题 (1)题目 英文: Given a binary tree, find ...

  9. [swift] LeetCode 104. Maximum Depth of Binary Tree

    Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the long ...

  10. 104. Maximum Depth of Binary Tree (Easy)

    Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the long ...

最新文章

  1. Python并发编程实例教程
  2. pytorch函数整理
  3. javascript 本地对象和内置对象_JavaScript 的面向对象
  4. c语言的多线程,如何用C语言实现多线程
  5. mysql 里面不等于符号_mysql 不等于 符号写法
  6. 【渝粤题库】陕西师范大学202041 国际经济学 作业(专升本)
  7. eclipse maven 构建简单springmvc项目
  8. covid 19如何重塑美国科技公司的工作文化
  9. 解决“Class org.apache.hadoop.hdfs.DistributedFileSystem not found“问题
  10. 深度学习笔记(3) 向量化逻辑回归
  11. Linux(3) 用户管理
  12. 浮点数运算中的舍入问题
  13. 数数苹果手机中的不科学
  14. 串口服务器接无线网桥,AB7006-HMS串口服务器、Anybus-M主站、Anybus-S从站接口模块...
  15. vs2008 sp1 regex
  16. linux搭建dlna媒体服务器,群晖安装DLNA简单配置打造媒体服务器
  17. 西红柿助手的安装使用及其设置(Visual Assist X)
  18. 2021-2025年中国SWIR-InGaAs光电二极管线阵行业市场供需与战略研究报告
  19. Internet时间同步出错解决方法
  20. 医学图像中的atlas代表什么

热门文章

  1. 企业网络推广有效收录一定会带来排名?企业网络推广专员怎么说?
  2. 网络营销外包——网络营销外包专员如何帮助企业挑选网站建设类型
  3. 企业网络推广—企业网络推广专员一定要避免这些不靠谱的优化方式
  4. 网络营销——网络营销专员如何将网站优化技能持久点亮
  5. 网站开发绝不像你看到的那么简单!
  6. 企业网站外链发布有技巧
  7. python 微信模块_Python使用itchat模块实现简单的微信控制电脑功能示例
  8. java正则表达式逗号_正则表达式只匹配逗号而不是括号?
  9. (传送门)instant run原理
  10. sphinx索引分析——文件格式和字典是double array trie 检索树,索引存储 – 多路归并排序,文档id压缩 – Variable Byte Coding...