Given a binary tree, find its maximum depth.

The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.

解题思路:

递归,JAVA实现如下:

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

最新文章

  1. cookie详解
  2. linq 之 Distinct的使用
  3. Git教程学习(五)
  4. ASP.Net中无刷新执行Session身份验证
  5. Apache kafka原理与特性(0.8V)
  6. 2011 Asia Fuzhou Regional Contest
  7. 与MySQL交互(felixge/node-mysql)
  8. HTTP 缓存控制总结
  9. python小技巧
  10. 文件操作IO流
  11. 工程PMO工作
  12. Uncaught TypeError: Cannot read property 'call' of undefined jquery.validate.min.js:28
  13. 51驱动LCD12864
  14. Linux下软件的卸载
  15. cmd 安装mysql
  16. 下载安装Android sdk tools
  17. MySQL数据库优化的方式
  18. Sqli-labs之sql注入基础知识
  19. Python全栈开发之7、模块和几种常见模块以及format知识补充
  20. She must be at least thirty-five years old.

热门文章

  1. Beginning Auto Layout Tutorial in iOS 7: Part 1
  2. SCP和SFTP相同点和区别
  3. DNS_主从服务_详细搭建&&配置
  4. 2016.7.12 eclipse和IDEA中mybatis generator插件的安装与使用
  5. 【剑指Offer面试题】 九度OJ1368:二叉树中和为某一值的路径
  6. GetDlgItem() 出现错误
  7. 分享个免费的货币汇率API
  8. Linux装mysqli.so
  9. C#各种导入Excel文件的数据的方法总结
  10. H5缓存机制学习记录