2daysbeforeinterview
CompaniesProblemsExperiencesNotesSalary
Contribute
2daysbeforeinterview

Real interview questions, from real interviews, with the company and round attached.

Browse

  • Companies
  • Problems
  • Experiences
  • Salaries
  • Leaderboard

Contribute

  • Add a question
  • Share an experience
  • Report compensation
  • Send feedback

About

  • About 2daysbeforeinterview
  • Contact
  • Privacy
  • Terms

© 2026 2daysbeforeinterview

  • Instagram(opens in a new tab)
  • YouTube(opens in a new tab)
  • X (Twitter)(opens in a new tab)
  • [email protected]
CompaniesProblemsExperiencesNotes
DSAlast asked …Apple

Merge Two Sorted Lists

You're given the starting nodes (heads) of two linked lists, list1 and list2. Both are already sorted in increasing order.

Combine them into a single sorted linked list. Instead of creating brand-new nodes, reuse the existing nodes from the two lists and just relink them in the right order.

Return the head of this new combined 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: []

Constraints:

  • Each list can have anywhere from 0 to 50 nodes.
  • Every node's value is between -100 and 100.
  • Both lists are already sorted from smallest to largest (values may repeat).

Domains it comes up for

Backend Engineer
asked Jun 2026Report
Discussion
Related questions
My note
Practice
Asked atApple
Learning resources(3)
Editorial
Community solutions
Apple
Apple