Merge K sorted Arrays

IN the code when we pass the greater comparator how do we know it will correctly compare the custom defined pair?
Is the comparator always going to return the smaller integer value?
I did not understand what is the basis of the comparison

@aryamaan1011 hey thats internal working of priority queue ,you just have to make comparator for two elemnts of queue and pq will do its internal work and compare elements acc to that function.

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.