← All problems
Merge K Sorted Lists
Merge k sorted linked lists into one sorted list and return its head. A naive pairwise merge is too slow for large k — find the optimal strategy and analyze its complexity.
Complexity
Time O(N log k), Space O(k)
Common pitfalls
- Pairwise merging (TLE)
- Forgetting to push next after pop
Your solution
Log in to save your code and track progress.