Merge linked list


why is it showing TLE
complexity is O(n)

Hey @divyam_13 you are getting TLE cause of this


Correct this and let me know is it working or not.


still showing tle

Hey @divyam_13 you are making two linked list f and s in descending order
F- 6 4 2
S - 5 3 1
and the code you wrote is for merging two linked list in ascending order. Try to implement it and then let me know if it’s working or not.

no
insertion is taking place at head so
f - 2 4 6
s - 1 3 5

is my merge function correct ?

Hey , i haven;t focused on your insert function . Yes you are right. Your insert function is at head. Error is in your merge function. You should do it recursively.

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.