QUESTION:
Dean of MAIT is going to visit Hostels of MAIT. As you know that he is a very busy person so he decided to visit only first “K” nearest Hostels. Hostels are situated in 2D plane. You are given the coordinates of hostels and you have to answer the Rocket distance of Kth nearest hostel from origin ( Dean’s place ) .
MY DOUBT:
The editorial solution is done with a heap, but I came up with the solution with pbds and it works for the all test cases except the last one, can you explain why is that?
Here is my solution: