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
2023-12-09 18:53:53 +08:00

26 lines
851 B
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p>某公司架构以二叉树形式记录,请返回该公司的层级数。</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<p><img alt="" src="https://pic.leetcode.cn/1695101942-FSrxqu-image.png" /></p>
<pre>
<strong>输入:</strong>root = [1, 2, 2, 3, null, null, 5, 4, null, null, 4]
<strong>输出: </strong>4
<strong>解释: </strong>上面示例中的二叉树的最大深度是 4沿着路径 1 -&gt; 2 -&gt; 3 -&gt; 4 或 1 -&gt; 2 -&gt; 5 -&gt; 4 到达叶节点的最长路径上有 4 个节点。
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>节点总数 &lt;= 10000</code></li>
</ul>
<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>
<p>&nbsp;</p>