Getting wrong answer in one of the test cases

I have used a max heap which stores only k elements at a time so that when we have to print the kth largest element we just print the top of the heap. But using this approach i am getting wrong answer in one of the test cases.

Please share your code using ide.codingblocks.com

Hi Kishan ,
I have made the required changes and marked them in the code. Please refer to it

Updated Code - https://ide.codingblocks.com/s/97803

1 Like

Thanks a lot. I got the changes.

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.