Merge k sorted lists

here is the problem :

here is my code :

this code is giving TLE even for very small test cases and i have checked there is no infinite loop. can you please tell the mistake in my code.

hello @alankrit.agr99
image
here u should push temp1->next

also handle the corner case where input is empty

1 Like

ya done, thanx :smile:

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.