Merge Two Sorted Lists

Merge two sorted linked lists and return it as a new list.
The new list should be made by splicing together the nodes of the first two lists, and should also be sorted.

For example, given following linked lists :

  5 -> 8 -> 20 
  4 -> 11 -> 15

The merged list should be :

4 -> 5 -> 8 -> 11 -> 15 -> 20
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details.
Start solving Merge Two Sorted Lists on Interview Code Editor
Sign Up
to access hints and editorial solutions for Merge Two Sorted Lists
9749 successful submissions.
Asked In:
  • Microsoft
  • Yahoo
Click here to start solving coding interview questions