Here’s my code , why is the test case 2 not passing?
Test Case 2 Failing : Hotel Visit
The test case 2 got accepted now after replacing int with long long int but wondering why did the max heap worked here if we were supposed to print the nearest distance.
Hi @raghav6 , in simplest terms min heap will store in descending order and max heap will store in ascending order. And we needed the kth nearest i.e. kth distance in ascending order.
Hope this helps 
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.