Merge k sorted arrays


hey what is wrong with my code

Hello @Dhruv-Miglani-2090236747707980,

  1. Please, read the constraints properly.
    1<=t<=100 1<=n<=1000000
    So, N should be 1000000

  2. You have to create a matrix of size kXN else it will exceed memory constraint.

  3. There is a logical error that is causing wrong output:
    change if(c<k-1) to if(c<n-1)

Here’s your modified code:

Hope, this would help.
Give a like if you are satisfied.

1 Like

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.