Problem
You get an array lists of k linked lists. A linked list is a chain of nodes, and each node links to the next node.
The values in each linked list are in non-decreasing order. Thus, each value is equal to or greater than the value before it.
Merge all the linked lists into one linked list in non-decreasing order, and return its head. The input shows each linked list as an array of its values. Your function gets a list of head nodes.
Example 1
- Input:
- lists = [[2,6,9],[1,4],[3,5,10]]
- Output:
- [1,2,3,4,5,6,9,10]
Example 2
- Input:
- lists = [[],[7]]
- Output:
- [7]
- Explanation:
- The first linked list is empty.
Constraints
- k == lists.length
- 0 <= k <= 10^4
- 0 <= lists[i].length <= 500
- -10^4 <= lists[i][j] <= 10^4
- Each lists[i] is in non-decreasing order.
- The sum of lists[i].length is at most 10^4.
SysRound wrote this statement. A reference solution checks every example.
Related questions
Continue with questions that share topics or the same question type.
- K Closest Points to Origin
Coding · Array · Divide and Conquer · Geometry
- Kth Largest Element in an Array
Coding · Array · Divide and Conquer · Heap (Priority Queue)
- Reverse Pairs
Coding · Array · Binary Indexed Tree · Binary Search
- Top K Frequent Elements
Coding · Array · Bucket Sort · Counting
Sources · 2 references
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 4 records
Amazon
Leetcode 23. Merge k Sorted Lists
Reported Jun 2, 2026 · 5 source reports
MID_LEVEL, SENIOR
Source snapshot: Nov 12, 2026
View sourceMeta
Leetcode 23. Merge k Sorted Lists
Reported Aug 31, 2026 · 32 source reports
MANAGER, MID_LEVEL, SENIOR, STAFF
Source snapshot: Nov 12, 2026
View sourceOracle
Leetcode 23. Merge k Sorted Lists
Reported Aug 6, 2026 · 3 source reports
SENIOR
Source snapshot: Nov 12, 2026
View sourceSnowflake
Leetcode 23. Merge k Sorted Lists
Reported Aug 10, 2025 · 2 source reports
MID_LEVEL
Source snapshot: Nov 12, 2026
View source