https://ide.codingblocks.com/s/78269 this is the link of my code
i m getting wrong answer please look into it
Getting wrong answer in hostel visit
i changed your code a little because x^2 cant be stored in integer
sir cant i implement it with min heap instead of max heap
from a pririty queue we can always have topmost element with us.
therefore using max heap would do fine .
if the size of max heap is above k yu delete topmost elements because you never need them.
so max heap always has a size of k , where the top most element is the kth maximum element