LeetCode刷题笔录 Maximum Depth of Binary Tree
来源:互联网 发布:淘宝图片像素 编辑:程序博客网 时间:2024/05/16 13:57
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.
递归吧。
public class Solution { public int maxDepth(TreeNode root) { if(root == null) return 0; else return 1 + Math.max(maxDepth(root.left), maxDepth(root.right)); }}
0 0
- LeetCode刷题笔录 Maximum Depth of Binary Tree
- LeetCode刷题笔录Minimum Depth of Binary Tree
- [leetcode刷题系列]Maximum Depth of Binary Tree
- Leetcode - Tree - Maximum Depth of Binary Tree
- [leetcode][tree] Maximum Depth of Binary Tree
- LeetCode Maximum Depth of Binary Tree
- [Leetcode] Maximum Depth of Binary Tree
- leetcode 24: Maximum Depth of Binary Tree
- [LeetCode] Maximum Depth of Binary Tree
- Leetcode 104 Maximum Depth of Binary Tree
- 【leetcode】Maximum Depth of Binary Tree
- [leetcode]Maximum Depth of Binary Tree
- [LeetCode]Maximum Depth of Binary Tree
- [leetcode]Maximum Depth of Binary Tree
- Leetcode: Maximum Depth of Binary Tree
- LeetCode-Maximum Depth of Binary Tree
- [leetcode] Maximum Depth of Binary Tree
- LeetCode - Maximum Depth of Binary Tree
- icons in win32
- 关于EXPORT_SYMBOL
- SAP Sybase SQL Anywhere数据库JDBC访问(纯Java,不需要native dll)
- ASMlib操作系统包安装与配置asm disk磁盘
- 用UpdateResource修改EXE文件图标的多源码
- LeetCode刷题笔录 Maximum Depth of Binary Tree
- X240的键盘鼠标用起来太不爽了!
- ChangeExeIcon
- 随感10-Transecndence超验骇客
- The area (HDU 1071)
- Linux下的LED子系统
- android Button 样式
- Timus 1935. Tears of Drowned 详解
- 出行路线图--五险地址