struct ListNode {
int val;
struct ListNode *next;
};
struct ListNode *mergeTwoLists(struct ListNode *l1, struct ListNode *l2) {
if (l1 == NULL)
return l2;
else if (l2 == NULL)
return l1;
struct ListNode *l3 = NULL;
if(l1->val < l2->val)
{
l3 = l1;
l3->next = mergeTwoLists(l1->next,l2);
}
else
{
l3 = l2;
l3->next = mergeTwoLists(l1,l2->next);
}
return l3;
}