1p3a Question · Jan 2026

Merge Two Sorted Lists

Question Details

Merge Two Sorted Lists

Problem Statement You start with the head nodes of two linked lists, labeled list1 and list2. Both of these lists are already sorted. Your task is to combine these two

Full Details

Merge Two Sorted Lists

Problem Statement You start with the head nodes of two linked lists, labeled list1 and list2. Both of these lists are already sorted. Your task is to combine these two lists into one single linked list that is also sorted. You must return the head of this newly merged list. The final list should consist of the specific nodes found in list1 and list2. ## Test Cases

Case 1:

Input: list1 = [1,2,4], list2 = [1,3,4]

Output: [1,1,2,3,4,4]

Case 2:

Input: list1 = [], list2 = []

Output: []

Case 3:

Input: list1 = [], list2 = [0]

Output: [0] ## Technical Constraints * The total number of nodes in each list is between 0 and 50. * The value of each Node is between -100 and 100. * Both list1 and list2 are sorted in non-decreasing order (from lowest to highest).

About This Question

This is a reported interview question from a snowflake interview for a swe role reported in 2025.

It covers the following topics: Linked List, Linked List .