1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-10 18:48:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/左叶子之和 [sum-of-left-leaves].html
2022-03-29 12:43:11 +08:00

32 lines
755 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>给定二叉树的根节点&nbsp;<code>root</code>&nbsp;,返回所有左叶子之和。</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<p><img src="https://assets.leetcode.com/uploads/2021/04/08/leftsum-tree.jpg" /></p>
<pre>
<strong>输入:</strong> root = [3,9,20,null,null,15,7]
<strong>输出:</strong> 24
<strong>解释:</strong> 在这个二叉树中,有两个左叶子,分别是 9 和 15所以返回 24
</pre>
<p><strong>示例&nbsp;2:</strong></p>
<pre>
<strong>输入:</strong> root = [1]
<strong>输出:</strong> 0
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li>节点数在&nbsp;<code>[1, 1000]</code>&nbsp;范围内</li>
<li><code>-1000 &lt;= Node.val &lt;= 1000</code></li>
</ul>
<p>&nbsp;</p>