Merge k sorted linked lists

by ripple1953
JPMorgan
junior
coding
medium
pending
11
205

The coding challenge was to merge k sorted linked lists. I started by discussing the naive approach of iterating through each list and adding elements to a new list, but I quickly pivoted to a more efficient strategy using a min-heap.

The interviewer seemed intrigued by this shift in thought. I implemented a min-heap approach to maintain the smallest elements efficiently.

As I worked through code, I paused to explain my thought process, which seemed to resonate well with the interviewer; they nodded and asked some clarifying questions to dig deeper into my understanding of heaps. At a certain point, I mismanaged the edge cases for empty lists and had to backtrack, which was a bit embarrassing.

Despite that, I managed to fix my mistake and finalize the implementation. The interviewer seemed satisfied, but occasionally I sensed doubt about my attention to detail.

After the coding part wrapped up, we had a nice discussion about my transition from finance to tech and the different skills I brought to the table. Overall, it felt like an amicable exchange, but I was left feeling uncertain about how I handled the initial errors.


Markdown supported