I am getting the TLE and not able to pass the testcases.
Please see the code and help:
Merge sorted linked lists
hi @Divyakharb
your logic is correct
one mistake you have done is
you forgot to intialize head and head1 to NULL in every testcase
correct one
while(t–)
{
head=NULL;
head1=NULL;
cin>>n;
for(int i=0;i<n;i++)
{
cin>>da;
insertatTail(head,da);
}
cin>>m;
for(int i=0;i<m;i++)
{
cin>>da;
insertatTail(head1,da);
}
}