Merging sorted linked lists


This is showing TLE.Please help.

TLE is because of line 37 which is leading to an infinite while loop.
Change line 37 to while(N–)

Now it is giving wrong answers to all the test cases.

In line 88 you are just printing the address of the head of the linked list which is incorrect.
You have to print the whole linked list as given in the sample output. So make a separate print function for it.

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.