# 23. 合并 K 个升序链表
---
👉 [23. 合并 K 个升序链表](https://leetcode-cn.com/problems/merge-k-sorted-lists/)
## 📜 题目描述
You are given an array of k linked-lists lists, each linked-list is sorted in ascending order.
Merge all the linked-lists into one sorted linked-list and return it.
**Example 1**:
```
Input: lists = [[1,4,5],[1,3,4],[2,6]]
Output: [1,1,2,3,4,4,5,6]
Explanation: The linked-lists are:
[
1->4->5,
1->3->4,
2->6
]
merging them into one sorted list:
1->1->2->3->4->4->5->6
```
**Example 2**:
```
Input: lists = []
Output: []
```
**Example 3**:
```
Input: lists = [[]]
Output: []
```
## 💡 解题思路
先看一下 [21 - 合并两个有序链表 Easy](计算机基础/算法/LeetCode/链表/21-合并两个有序链表.md)
本题解题思路同归并排序(分治法),两两归并,不断地将前后相邻的两个有序表归并为一个有序表
![](https://gitee.com/veal98/images/raw/master/img/20200928163012.png)
## ✅ 具体代码
```java
/**