Home
Topics
Practice
Roadmap
DSA Tracker
Code Editor
Tech Blogs
More
Sign in
Get started
Loading question...
Feedback
Merge K Sorted Lists
Hard
00:00
0 users online
Share
Description
Solution
Submissions
Discussion
Merge K sorted linked lists into one sorted linked list.
Sample Input:
[[1,4,5],[1,3,4],[2,6]]
Sample Output:
[1,1,2,3,4,4,5,6]
Hints
Hint 1
Use a min-heap to efficiently get the smallest element
Hint 2
Push the first element of each list into the heap
Hint 3
Extract the minimum and push the next element from that list
Code Editor
Reset
Run
Save
Loading...