Skip to content

Merge 2 Sorted Linked Lists LeetCode Solution 2022

Merge 2 Sorted Linked Lists LeetCode

Hi there, fellow geeks! In this article, let’s discuss how to merge 2 sorted linked lists LeetCode solution in a sorted manner.

Explanation of merge 2 sorted linked lists LeetCode problem:

We are given two non-empty single linked lists, sorted in ascending order, as input and the goal is to merge them in such a way that the resultant list is also sorted in ascending order. For example,

The first linked list, l1 is given as 4->7->10->NULL

And the second list, l2 is given as 5->6->7->12->20->NULL

Then the output is 4->5->6->7->7->10->12->20->NULL

 

l1:

l2: