43. Merge k Sorted Lists
Hard · Linked List
You are given k linked lists, each already sorted in ascending order. Merge them into a single sorted list.
To keep things simple, each linked list is represented as an array of its values. The input is an array of these arrays. Return one sorted array containing every value.
Examples
Example 1 Input: [[1,4,5],[1,3,4],[2,6]] Output: [1,1,2,3,4,4,5,6] Explanation: All values from the three lists merged in ascending order.
Example 2 Input: [] Output: [] Explanation: No lists means an empty result.
Constraints
- Standard input/output constraints apply