The problem. You're given an array of k linked lists, each sorted in ascending order. Merge them all into one sorted linked list and return its head.
lists = [[1,4,5], [1,3,4], [2,6]] -> [1,1,2,3,4,4,5,6]
lists = [] -> []
lists = [[]] -> []Below, N is the total number of nodes in all the lists, and k is the number of lists.
Free account
Sign up to read the rest of this lesson: 7 more sections, 2 drawings, a dry-run simulator and code in JavaScript, Python, Java and C++.
Still to come