Company: Epam_23_jan
Difficulty: medium
Merge Sorted Lists 2. Merge Sorted Lists Problem Statement You are given two sorted linked lists. Your task is to merge these two sorted linked lists into a single sorted linked list. Implement a function that takes the heads of two linked lists and returns the head of a new linked list that contains all the elements from the two input lists, sorted in non-decreasing order. Input Format The first line contains an integer n1 , which is the number of elements in the first list. The next n1 lines contain the elements of the first list. The line after the last element of the first list contains an integer n2 , which is the number of elements in the second list. The following n2 lines contain the elements of the second list. Output Format Return the head of the merged linked list. The elements should be in non-decreasing order. Constraints Each linked list contains at most 10 5 elements. The elements in the linked lists are integers and are within the range of -10 9 to 10 9 . Sample Input 4