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.

Example 1:
Input: list1 = [1,2,4], list2 = [1,3,4]
Output: [1,1,2,3,4,4]Example 2:
Input: list1 = [], list2 = []
Output: []Example 3:
Input: list1 = [], list2 = [0]
Output: [0]SOLUTION In JAVA:

EXPLANATION :
- Initialization: The code creates a dummy node for the result list and a pointer to the current node in the result list.
- While loop: The code continues to loop until both input linked lists are empty.
- Null check: The code checks if either list1 or list2 is null. If one of the lists is empty, the code adds the remaining elements of the non-empty list to the result list and breaks the loop.
- Comparison: If neither list1 nor list2 is empty, the code compares the values at the head of both lists. If the value in list1 is smaller, it is added to the result list and list1 moves to its next node. If the value in list2 is smaller, it is added to the result list and list2 moves to its next node.
- Pointer update: The code updates the pointer to the current node in the result list to the next node in the result list.
- Return: The code returns the next node of the dummy node in the result list, effectively excluding the dummy node from the final result.



