Grokking the Coding Interview: Patterns for Coding Questions
Vote

0% completed

​

Solution: Merge K Sorted Lists

.....

.....

.....

Like the course? Get enrolled and start learning!
A

Anonymous

· 3 years ago

In the case of sorted lists, to merge them using a heap, I have to maintain a pointer to the list where the smaller element is being taken. In the case of LL it is simple to get the next element using a node.next, but how do we get the next element in the case of lists?

A

Anonymous

· 4 years ago

How to do the question without defining an additional def lt(self, other): . In leetCode I'm not allowed to do that, but without that I cannot put nodes into the heap.

Show 3 replies
A

Anonymous

· 4 years ago

this code is not working, how is it possible to compare value of two nodes?

Show 1 reply

Reading Progress

0%


Vote for new content