1.题意

104. Maximum Depth of Binary Tree

Easy

98540

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.

Note: A leaf is a node with no children.

Example:

Given binary tree [3,9,20,null,null,15,7],

    3/ \9  20/  \15   7

return its depth = 3.

2.代码

class Solution {
public:int maxDepth(TreeNode* root) {if(root==NULL) {return 0;}else return max(1 + maxDepth(root -> left), 1 + maxDepth(root -> right));}
};

LC 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. 【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 ...

  3. 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 ...

  4. 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 ...

  5. 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 ...

  6. 【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 ...

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

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

  8. [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 ...

  9. 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. 分布式服务框架 dubbo/dubbox 入门示例(转)
  2. LVS负载均衡群集部署之——DR模式的介绍及搭建步骤
  3. 极光推送 android 最新,Android——快速集成极光推送-Go语言中文社区
  4. Web.py session用户认证
  5. 1047: 对数表 ZZULIOJ
  6. STM32 SPI驱动OLED12864原理图和源代码分享
  7. [转]struct和class的区别 观察者模式 https连接 点击button收到点
  8. Windows编程语言VBA学习(四)——VBA代码调试
  9. jojo第七部dio怎么复活_JOJO杂谈:DIO复活的那些年到底在干什么?
  10. 在centos上更改服务器时区(美国时间、北京时间)
  11. 谨慎选择我们的先验 - 对最优拟合概率分布搜索空间的一种约束
  12. java马里奥_java马里奥毕业设计
  13. 【机器学习】基于生成对抗网络的黑白图片上色
  14. java nio 学习笔记2
  15. 思科模拟器入门基础-静态路由
  16. Ubuntu防火墙UFW
  17. 解决maven库中没有Oracle jdbc驱动的问题Cannot resolve com.oracle:ojdbc14:10.2.0.1.0
  18. 1.操作系统——内核
  19. 错误代码 0x80070035 找不到网络路径 终极解决办法
  20. 未明学院:有趣or有用,九款人工智能小程序/APP推荐给你

热门文章

  1. 关于电影的HTML网页设计-威海影视网站首页-电影主题HTM5网页设计作业成品
  2. inet_addr报错
  3. 4K高清壁纸应用Pap.er Mac中文版
  4. 【优化】梯度下降 收敛性 证明
  5. java 实现登录超时,Java-实现异地登陆和超时登陆
  6. 使用uber数据集和kelpergl做路网动态可视化
  7. [源码和文档分享]基于C++的餐厅管理程序的设计与实现
  8. 2019最新计算机毕业设计-题目汇总大全-系列4
  9. Azkaban (一) --------- Azkaban 概论
  10. 1000元计算机配置方案,1000元赛扬J345低功耗主机推荐 2018最便宜电脑配置方案 (全文)...