mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-10 18:48:13 +08:00
29 lines
801 B
HTML
29 lines
801 B
HTML
<p>给你一棵二叉树的根节点 <code>root</code> ,请你返回 <strong>层数最深的叶子节点的和</strong> 。</p>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong>示例 1:</strong></p>
|
||
|
||
<p><strong><img alt="" src="https://assets.leetcode-cn.com/aliyun-lc-upload/uploads/2019/12/28/1483_ex1.png" style="height: 265px; width: 273px;" /></strong></p>
|
||
|
||
<pre>
|
||
<strong>输入:</strong>root = [1,2,3,4,5,null,6,7,null,null,null,null,8]
|
||
<strong>输出:</strong>15
|
||
</pre>
|
||
|
||
<p><strong>示例 2:</strong></p>
|
||
|
||
<pre>
|
||
<strong>输入:</strong>root = [6,7,8,2,7,1,3,9,null,1,4,null,null,null,5]
|
||
<strong>输出:</strong>19
|
||
</pre>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong>提示:</strong></p>
|
||
|
||
<ul>
|
||
<li>树中节点数目在范围 <code>[1, 10<sup>4</sup>]</code> 之间。</li>
|
||
<li><code>1 <= Node.val <= 100</code></li>
|
||
</ul>
|