154: Merge two sorted linked lists

Given two sorted linked list, return the merged one

 

Example 1

Input:  list1 = 1 -> 2 -> 3, list2 = 1 -> 4

Output: 1 -> 1 -> 2 -> 3 -> 4

Example 2

Input:  list1 = 1 -> 2 -> 3, list2 = 4 -> 5

Output: 1 -> 2 -> 3 -> 4 -> 5
Difficulty:Easy
Topic:Linked list
Problem #:154