You are given the heads of two sorted linked lists list1 and list2. Merge the two lists in a one sorted list. The list should be made by splicing together the nodes of the first two lists. Return the head of the merged linked list.
Asked at 29 companies
AdobeAirbnbAlibaba
Hints
1.Think about what data structure fits Merge Two Sorted Lists
2.Consider the brute force complexity and how to optimize