Hostel visit problem

In queston they haven’t mentioned about popping the topmost element whenever the topmost element is less than current element if size == k

@msid78641 yes its not mentioned, but it is obvious that you don’t require more than kth element so you can pop it!!