mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-11 02:58:13 +08:00
26 lines
851 B
HTML
26 lines
851 B
HTML
<p>某公司架构以二叉树形式记录,请返回该公司的层级数。</p>
|
||
|
||
<p> </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 -> 2 -> 3 -> 4 或 1 -> 2 -> 5 -> 4 到达叶节点的最长路径上有 4 个节点。
|
||
</pre>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong>提示:</strong></p>
|
||
|
||
<ul>
|
||
<li><code>节点总数 <= 10000</code></li>
|
||
</ul>
|
||
|
||
<p>注意:本题与主站 104 题相同:<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> </p>
|