Tle problem plz help
@Rajat-Sharma-2078329489142103
In this problem, you need to find the kth nearest, which means that the largest distance if the k-hostels are arranged in the increasing order of the distances.
So use a priority queue.
You also have to maintain its size as k, so whenever the size of pq becomes k then if again query of type 1 comes, then first you will check if the distance for that new point is less than the max element (top of priority queue), then only insert it in the pq.
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.