Merge two non-decreasing ordered linked lists into one non-increasing ordered linked list code

This can be achieved using the following code: ListNode* mergeTwoLists(ListNode* l1, ListNode* l2) { ListNode* result = NULL; ListNode* temp = NULL; while(l1 != NULL && l2 != NULL) { if(l1->val < l2->val) { if(result == NULL) { result = l1; temp = res ult; }

Guess you like

Origin blog.csdn.net/weixin_35749440/article/details/129494271