Could you please check my code?
Run time error in code
Doesn’t solve. still says RUNTIME error on all test cases.
@priyamthakuria27 send head by reference in the insert function. Please always test your code for the sample input and match the output for sample output, they are given for a reason.
@priyamthakuria27 try to add the condition in the very starting of merge function
if (head1 == NULL) return head2;
if (head2 == NULL) return head1;
It is giving segmentation fault if any one of the linked lists is empty. You are assuming that at least 1 node will be there in both lists