Getting TLE in last test-case. Here is the code link:
Hostel Visit Heap Question
you approach is not wrong
but time complexity of your code is high
because you are popping and then pushing the elements in priority queue repeatedly
try to use max heap instead of min heap
you can use this code as Reference
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.
Hi can you pls tell me what’s wrong in my implementation of Dijkstra.
you can post new doubt for this
i will reply on that
okay bro I will make a new post
Here is the new post
Thanks @asaurabh_26, but I am still confused about why you use multiset. Is multiset works as a priority queue? If u help me it would be great.
ohh
that’s my bad
i want you to send Max priority queue approach but by mistake send multset approach
Max priority Queue Approach