LeetCode题解:Maximum Depth of Binary Tree
来源:互联网 发布:手机连不上4g网络 编辑:程序博客网 时间:2024/05/17 03: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.
题意:给定二叉树,找出最大深度
思路:DFS
public class Solution { public int maxDepth(TreeNode root) { if(root == null){ return 0; } return Math.max(maxDepth(root.left), maxDepth(root.right)) + 1; }}
0 0
- LeetCode题解:Maximum Depth of Binary Tree
- LeetCode题解:Maximum Depth of Binary Tree
- LeetCode题解:Maximum Depth of Binary Tree
- LeetCode 题解(12):Maximum Depth of Binary Tree
- 【LeetCode】【Python题解】Single Number & Maximum Depth of Binary Tree
- Leetcode题解 104. Maximum Depth of Binary Tree
- LeetCode题解-104-Maximum Depth of Binary Tree
- [LeetCode] Maximum Depth Of Binary Tree Python 题解
- LeetCode 104: Maximum Depth of Binary Tree 题解
- LeetCode 104. Maximum Depth of Binary Tree 题解(C++)
- LeetCode 104 Maximum Depth of Binary Tree题解
- LeetCode 104. 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
- 算法代码实现之冒泡排序,Golang(Go语言)实现
- C语言实现双向非循环链表(不带头结点)的基本操作
- 微信零钱提现不到账
- Android通过DexClassLoader加载apk文件
- POJ3252数位DP
- LeetCode题解:Maximum Depth of Binary Tree
- 《JAVA编程思想》日志(三)------操作符
- Java 快速排序
- mybatis学习笔记(1)-对原生jdbc程序中的问题总结
- H5 canvas drawImage 无法显示
- CMD卸载3035583、去win10
- androidstudio入门-新建模拟器
- AndroidStudio初体验
- mybatis学习笔记(2)-mybatis概述