How to do this question

how to perform this problem

@hhiteshbansal_40d12e2460a1738e,

  1. Make a priority queue where each node stores three values - the element itself , its row no. and its col no.
  2. Push the first elements of all the rows into this priority queue with their corresponding row and column info.
  3. One by one , take nodes out of this priority queue and insert their values into the final sorted array.
  4. Also push the next element of the same row using the other information into the priority queue.
  5. Repeat this process till the priority queue gets empty.

@hhiteshbansal_40d12e2460a1738e,
check this https://ide.codingblocks.com/s/655878 if u r having implementation difficulties

@hhiteshbansal_40d12e2460a1738e,
is the doubt clear??