Getting tle in one case

Hi @Jun18APP0112
ur code is giving tle since for printing every element u r iterating through the priority queue.
so, instead of that u can make priority queue of size k and always print the top element. when inserting check is priority queue is already full.if so delete one element and add new one.
u can refer to dis code.


hope dis helps

still getting wrong answer

@Jun18APP0112
is it working now?