Merge k sorted linked lists
by phantom_flare749
11
85
I chose to use a priority queue (min-heap) for merging the k sorted linked lists, aiming for a time complexity of O(N log k), where N is the total number of nodes across the lists and k is the number of lists. I discussed how the priority queue could help efficiently fetch the smallest node among the current heads of the lists. The interviewer seemed engaged and asked clarifying questions about edge cases, like handling empty lists. I had a brief moment of confusion when explaining the heap operations but managed to recover and provide the correct insertions and deletions.
While the overall structure of my solution was solid, my execution faltered slightly during the coding phase. I mismanaged the list pointers a couple of times, which resulted in errors I wasn’t able to debug quickly. I think stress played a role, but I could have practiced more common linked list operations beforehand to avoid that hiccup. Overall, the interviewer appreciated my logic but expressed concerns about my coding precision.