bugl
bugl
HomeLearnPatternsPathsSearchPremium
HomeLearnPatternsPaths
HardHeap / Priority QueueLC 23

Merge K Sorted Lists

You are given an array of k linked-lists lists, each linked-list is sorted in ascending order. Merge all the linked-lists into one sorted linked-list and return it.

Asked at 37 companies
AdobeAirbnbAlibaba
Hints
  • 1.Think about what data structure fits Merge K Sorted Lists
  • 2.Consider the brute force complexity and how to optimize
  • 3.Can you trade space for time?
LeetCodeNeetCode