← 返回 bytedance 的题目列表Merge k Sorted Linked Lists into One Sorted List
类型:online_judge
bytedance
Merge k Sorted Lists
Given an array of linked-lists, each linked-list is sorted in ascending order. Merge all the linked-lists into one sorted linked-list and return its head. Each input linked list may be empty.
Input:
Lists containing collections of integers stored in linked-lists.
Output:
A new linked-list.
Example:
Input: [[1,4,5],[1,3,4],[2,6]]
Output: [1,1,2,3,4,4,5,6]
Constraints:
k is the number of linked lists, 0 <= k <= 10^4.
The number of nodes in each linked-list is in the range [0, 500].
All linked-list integers are in the range [-10^4, 10^4].
Example
Input
[[1,4,5],[1,3,4],[2,6]]