mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-12 02:41:42 +08:00
存量题库数据更新
This commit is contained in:
@@ -1,16 +1,32 @@
|
||||
<p>给定一个二叉树,找出其最大深度。</p>
|
||||
<p>给定一个二叉树 <code>root</code> ,返回其最大深度。</p>
|
||||
|
||||
<p>二叉树的深度为根节点到最远叶子节点的最长路径上的节点数。</p>
|
||||
<p>二叉树的 <strong>最大深度</strong> 是指从根节点到最远叶子节点的最长路径上的节点数。</p>
|
||||
|
||||
<p><strong>说明:</strong> 叶子节点是指没有子节点的节点。</p>
|
||||
<p> </p>
|
||||
|
||||
<p><strong>示例:</strong><br>
|
||||
给定二叉树 <code>[3,9,20,null,null,15,7]</code>,</p>
|
||||
<p><strong>示例 1:</strong></p>
|
||||
|
||||
<pre> 3
|
||||
/ \
|
||||
9 20
|
||||
/ \
|
||||
15 7</pre>
|
||||
<p><img alt="" src="https://assets.leetcode.com/uploads/2020/11/26/tmp-tree.jpg" style="width: 400px; height: 277px;" /></p>
|
||||
|
||||
<p>返回它的最大深度 3 。</p>
|
||||
<p> </p>
|
||||
|
||||
<pre>
|
||||
<b>输入:</b>root = [3,9,20,null,null,15,7]
|
||||
<b>输出:</b>3
|
||||
</pre>
|
||||
|
||||
<p><strong>示例 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<b>输入:</b>root = [1,null,2]
|
||||
<b>输出:</b>2
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong>提示:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li>树中节点的数量在 <code>[0, 10<sup>4</sup>]</code> 区间内。</li>
|
||||
<li><code>-100 <= Node.val <= 100</code></li>
|
||||
</ul>
|
||||
|
Reference in New Issue
Block a user