hard
Merge k Sorted Lists
You are given k linked lists, each sorted in ascending order. Merge them into a single sorted linked list and return its head.
Constraints
- 0 ≤ k ≤ 10^4
- Total nodes ≤ 10^4 · 500
- -10^4 ≤ node value ≤ 10^4
Examples
in: lists = [[1,4,5],[1,3,4],[2,6]]
out: [1,1,2,3,4,4,5,6]
Code it yourself
Solve in
Test execution is not yet available for this exercise.Practice journal →Draft saved in this browser.
Hints:
Which approach applies?
Choose an approach to check your pattern recognition, or reveal the discussion when you need help.