mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-10 18:48:13 +08:00
52 lines
1.3 KiB
HTML
52 lines
1.3 KiB
HTML
<p>给定一个链表数组,每个链表都已经按升序排列。</p>
|
||
|
||
<p>请将所有链表合并到一个升序链表中,返回合并后的链表。</p>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong>示例 1:</strong></p>
|
||
|
||
<pre>
|
||
<strong>输入:</strong>lists = [[1,4,5],[1,3,4],[2,6]]
|
||
<strong>输出:</strong>[1,1,2,3,4,4,5,6]
|
||
<strong>解释:</strong>链表数组如下:
|
||
[
|
||
1->4->5,
|
||
1->3->4,
|
||
2->6
|
||
]
|
||
将它们合并到一个有序链表中得到。
|
||
1->1->2->3->4->4->5->6
|
||
</pre>
|
||
|
||
<p><strong>示例 2:</strong></p>
|
||
|
||
<pre>
|
||
<strong>输入:</strong>lists = []
|
||
<strong>输出:</strong>[]
|
||
</pre>
|
||
|
||
<p><strong>示例 3:</strong></p>
|
||
|
||
<pre>
|
||
<strong>输入:</strong>lists = [[]]
|
||
<strong>输出:</strong>[]
|
||
</pre>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong>提示:</strong></p>
|
||
|
||
<ul>
|
||
<li><code>k == lists.length</code></li>
|
||
<li><code>0 <= k <= 10^4</code></li>
|
||
<li><code>0 <= lists[i].length <= 500</code></li>
|
||
<li><code>-10^4 <= lists[i][j] <= 10^4</code></li>
|
||
<li><code>lists[i]</code> 按 <strong>升序</strong> 排列</li>
|
||
<li><code>lists[i].length</code> 的总和不超过 <code>10^4</code></li>
|
||
</ul>
|
||
|
||
<p> </p>
|
||
|
||
<p><meta charset="UTF-8" />注意:本题与主站 23 题相同: <a href="https://leetcode-cn.com/problems/merge-k-sorted-lists/">https://leetcode-cn.com/problems/merge-k-sorted-lists/</a></p>
|