I am using python to code for this concept pack.
In this particular module, I have passed all the test cases but after completion when I saw the approach provided, I think it is not possible in python
I am using heapq for this. As provided in the solution we can add the node in the heap one by one but in python it won’t compare the nodes. I have tried a similar approach with PriorityQueue and it results with the same TypeError.
my code which generates TypeError:-
where l is the heap array
TypeError: ‘<’ not supported between instances of ListNode and ListNode
I know why it is generating that, my question is how else, in python, can we do this question with this approach?