23. Merge k Sorted Lists

Practice Merge k Sorted Lists for free on NudgeCode: Hard, Linked List pattern. Write it in Python or JavaScript, run the tests in your browser, and ask for a hint when you are stuck.

You are given an array of k linked lists, each sorted in ascending order. Merge them all into one sorted linked list and return its head.

Example

lists = [[1,4,5],[1,3,4],[2,6]]  ->  [1,1,2,3,4,4,5,6]

Constraints