1. You are given a partially written LinkedList class. 2. You are required to complete the body of mergeTwoSortedLists function. The function is static and is passed two lists which are sorted. The function is expected to return a new sorted list containing elements of both lists. Original lists must stay as they were. 3. Input and Output is managed for you.
Input Format
Input is managed for you
Output Format
Output is managed for you
Constraints
1. O(n) time complexity and constant space complexity expected.
Notice
Try First, Check Solution later
1. You should first read the question and watch the question video.2. Think of a solution approach, then try and submit the question on editor tab.3. We strongly advise you to watch the solution video for prescribed approach.Example
Input
5 10 20 30 40 50 10 7 9 12 15 37 43 44 48 52 56
Output
7 9 10 12 15 20 30 37 40 43 44 48 50 52 56 10 20 30 40 50 7 9 12 15 37 43 44 48 52 56