mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-10 18:48:13 +08:00
55 lines
1.7 KiB
HTML
55 lines
1.7 KiB
HTML
<p>给定一颗根结点为 <code>root</code> 的二叉树,树中的每一个结点都有一个 <code>[0, 25]</code> 范围内的值,分别代表字母 <code>'a'</code> 到 <code>'z'</code>。</p>
|
||
|
||
<p>返回 <em><strong>按字典序最小</strong> 的字符串,该字符串从这棵树的一个叶结点开始,到根结点结束</em>。</p>
|
||
|
||
<blockquote>
|
||
<p>注<strong>:</strong>字符串中任何较短的前缀在 <strong>字典序上</strong> 都是 <strong>较小</strong> 的:</p>
|
||
|
||
<ul>
|
||
<li>例如,在字典序上 <code>"ab"</code> 比 <code>"aba"</code> 要小。叶结点是指没有子结点的结点。 </li>
|
||
</ul>
|
||
</blockquote>
|
||
|
||
<p>节点的叶节点是没有子节点的节点。</p>
|
||
|
||
<p> </p>
|
||
|
||
<ol>
|
||
</ol>
|
||
|
||
<p><strong>示例 1:</strong></p>
|
||
|
||
<p><strong><img alt="" src="https://assets.leetcode-cn.com/aliyun-lc-upload/uploads/2019/02/02/tree1.png" style="height: 358px; width: 534px;" /></strong></p>
|
||
|
||
<pre>
|
||
<strong>输入:</strong>root = [0,1,2,3,4,3,4]
|
||
<strong>输出:</strong>"dba"
|
||
</pre>
|
||
|
||
<p><strong>示例 2:</strong></p>
|
||
|
||
<p><img src="https://assets.leetcode.com/uploads/2019/01/30/tree2.png" /></p>
|
||
|
||
<pre>
|
||
<strong>输入:</strong>root = [25,1,3,1,3,0,2]
|
||
<strong>输出:</strong>"adz"
|
||
</pre>
|
||
|
||
<p><strong>示例 3:</strong></p>
|
||
|
||
<p><img src="https://assets.leetcode.com/uploads/2019/02/01/tree3.png" style="height: 513px; width: 490px;" /></p>
|
||
|
||
<pre>
|
||
<strong>输入:</strong>root = [2,2,1,null,1,0,null,0]
|
||
<strong>输出:</strong>"abc"
|
||
</pre>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong>提示:</strong></p>
|
||
|
||
<ul>
|
||
<li>给定树的结点数在 <code>[1, 8500]</code> 范围内</li>
|
||
<li><code>0 <= Node.val <= 25</code></li>
|
||
</ul>
|