leetcode-104-二叉树深度
来源:互联网 发布:软件开发 书籍 知乎 编辑:程序博客网 时间:2024/05/29 12:47
public class Solution { /*public int maxDepth(TreeNode root) { if (root == null) return 0; int left = 1, right = 1; left += maxDepth(root.left); right += maxDepth(root.right); return left > right ? left : right; }*/ public int maxDepth(TreeNode root) { if (root == null) return 0; int left, right; left = maxDepth(root.left); right = maxDepth(root.right); return Math.max(left, right) + 1; }}
0 0
- leetcode-104-二叉树深度
- [LeetCode] 104 二叉树最大深度
- leetcode 二叉树最小深度
- 二叉树的最大深度(leetcode-104)
- leetcode 104求二叉树的最大深度
- LeetCode 二叉树的最小深度
- leetcode 二叉树的最小深度
- LeetCode:求二叉树的深度
- LeetCode:寻找二叉树的最小深度
- leetcode 111-二叉树最小深度
- LeetCode:104_Maximum Depth of Binary Tree | 二叉树的最大深度 | 深度优先与广度优先深入理解
- leetcode 104 Maximum Depth of Binary Tree二叉树求深度
- [LeetCode-104] Maximum Depth of Binary Tree(二叉树最大深度)
- LeetCode 104 Maximum Depth of Binary Tree(二叉树的最大深度)
- Leetcode No.104 Maximum Depth of Binary Tree 遍历二叉树的深度
- LeetCode:104_Maximum Depth of Binary Tree | 二叉树的最大深度 | Easy
- LeetCode-104 Maximum Depth of Binary Tree 二叉树的最大深度
- 【LeetCode】Maximum Depth of Binary Tree (二叉树最大深度)
- h5+css3 <canvas>实现五子棋
- Android绘图之Shader
- [设计模式]迭代器模式(Iterator)
- php 忽略非法字符集
- [LeetCode]Unique Substrings in Wraparound String
- leetcode-104-二叉树深度
- 第十一周
- Mysql 字符集
- 互联网的载体--操作系统
- c posix thread mutex cond rwlock
- 程序员领养群破解笔记
- 利用淘宝ip库限制地区访问
- Angular开发前的准备
- windows系统经常出现卡顿现象的解决方案