1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-11 02:58:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/二叉树的深度 [er-cha-shu-de-shen-du-lcof].html

24 lines
682 B
HTML
Raw Normal View History

2022-03-27 20:38:29 +08:00
<p>输入一棵二叉树的根节点,求该树的深度。从根节点到叶节点依次经过的节点(含根、叶节点)形成树的一条路径,最长路径的长度为树的深度。</p>
<p>例如:</p>
<p>给定二叉树 <code>[3,9,20,null,null,15,7]</code></p>
<pre> 3
/ \
9 20
/ \
15 7</pre>
<p>返回它的最大深度&nbsp;3 。</p>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ol>
<li><code>节点总数 &lt;= 10000</code></li>
</ol>
<p>注意:本题与主站 104&nbsp;题相同:<a href="https://leetcode-cn.com/problems/maximum-depth-of-binary-tree/">https://leetcode-cn.com/problems/maximum-depth-of-binary-tree/</a></p>