mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-11 02:58:13 +08:00
31 lines
970 B
HTML
31 lines
970 B
HTML
<p>给你 <code>root1</code> 和 <code>root2</code> 这两棵二叉搜索树。请你返回一个列表,其中包含 <strong>两棵树 </strong>中的所有整数并按 <strong>升序</strong> 排序。.</p>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong>示例 1:</strong></p>
|
||
|
||
<p><img alt="" src="https://assets.leetcode-cn.com/aliyun-lc-upload/uploads/2019/12/29/q2-e1.png" /></p>
|
||
|
||
<pre>
|
||
<strong>输入:</strong>root1 = [2,1,4], root2 = [1,0,3]
|
||
<strong>输出:</strong>[0,1,1,2,3,4]
|
||
</pre>
|
||
|
||
<p><strong>示例 2:</strong></p>
|
||
|
||
<p><img alt="" src="https://assets.leetcode-cn.com/aliyun-lc-upload/uploads/2019/12/29/q2-e5-.png" /></p>
|
||
|
||
<pre>
|
||
<strong>输入:</strong>root1 = [1,null,8], root2 = [8,1]
|
||
<strong>输出:</strong>[1,1,8,8]
|
||
</pre>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong>提示:</strong></p>
|
||
|
||
<ul>
|
||
<li>每棵树的节点数在 <code>[0, 5000]</code> 范围内</li>
|
||
<li><code>-10<sup>5</sup> <= Node.val <= 10<sup>5</sup></code></li>
|
||
</ul>
|