Back to course home
0% completed
Vote For New Content
How to do the question without defining an additional def __lt__(self, other): ....
Charlotte
Sep 18, 2022
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.
0
0
Comments
Comments
J
C
calvio 2 years ago
Miguel a year ago
If you are using python, you can store a tuple: (linkedList.val, linkedList)
Heapq (python's heap library) uses the first item for comparison when storing a list or tuple
It could look something like this:
class Solution: def merge(self, lists): i...
On this page