Hi,
Please give any hint.
Hostel visit doubt
hello @vatsal50 by this question you can learn the concept of priority queue.
make the max heap and the question will be done you have to just check which of type of query is this and according to that you can perform the operation like .
if the query ios of type 1 then you can have to take inout two variables and then you can do push in priority queue aa+bb, and if the query is of type 2 then you can check if priority queue sixe is greater then k then you can make pop operation queue until its size becomes equal to k and then the top element of the priority queue is the answer but if the queue size is already k then the top element is already the answer .
if you still have any doubt you can ask here .
here for refernce i am sharing the code :
Happy Learning !!
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.