1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-11 02:58:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/两棵二叉搜索树中的所有元素 [all-elements-in-two-binary-search-trees].html

31 lines
970 B
HTML
Raw Normal View History

2022-03-27 20:37:52 +08:00
<p>给你&nbsp;<code>root1</code><code>root2</code>&nbsp;这两棵二叉搜索树。请你返回一个列表,其中包含&nbsp;<strong>两棵树&nbsp;</strong>中的所有整数并按 <strong>升序</strong> 排序。.</p>
<p>&nbsp;</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>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li>每棵树的节点数在&nbsp;<code>[0, 5000]</code> 范围内</li>
<li><code>-10<sup>5</sup>&nbsp;&lt;= Node.val &lt;= 10<sup>5</sup></code></li>
</ul>