Merge k sorted linked lists
by ethereal2186
Google
mid
coding
medium
rejected
4
8
During the interview, I proposed using a min-heap to efficiently merge the k sorted linked lists. The idea was to maintain the minimum element at the top of the heap, thus allowing for efficient retrieval and insertion.
As I was walking through the solution, I saw the interviewer nodding along, which felt encouraging. I quickly sketched the algorithm on the whiteboard and spoke through the time complexity, estimating it at O(N log k), where N is the total number of nodes across all lists.
However, I struggled with edge cases and missed a couple of details about handling lists of varying lengths, which led to some probing questions that I unfortunately stumbled through.
Markdown supported