FastPrepMerge K Sorted Lists
Problems/Merge K Sorted Lists

Merge K Sorted Lists

Skydio logoSkydio● HardFULLTIMEONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A firsthand Skydio virtual-onsite report describes Merge K Sorted Lists. Our version is about 99% the same as the reported question.

You are given k singly linked lists, each sorted in nondecreasing order. Here, lists[i] holds the node values of the i-th list from head to tail.

Merge all the lists into one sorted linked list and return its values from head to tail. You may reuse the existing nodes or build a new merged list.

Function

mergeKSortedLists(lists: int[][]) → int[]

Examples

Example 1

lists = [[1,4,5],[1,3,4],[2,6]]return = [1,1,2,3,4,4,5,6]

Each time, take the smallest front value among the lists. That gives one, one, two, three, four, four, five, six, which is the full merged list in order.

Example 2

lists = []return = []

With no input lists, the merged list is empty.

Example 3

lists = [[],[-2,0,7],[]]return = [-2,0,7]

Empty lists contribute no nodes, so the one nonempty list is returned unchanged in value order.

Constraints

  • 0 <= lists.length <= 10000.
  • 0 <= lists[i].length <= 500.
  • The total number of values across all lists is at most 100000.
  • -10^9 <= lists[i][j] <= 10^9.
  • Every lists[i] is sorted in nondecreasing order.

More Skydio interview questions

  • Drone API Sliding-Window Rate LimiterPHONE SCREEN · Seen Jul 2024
  • Cumulative Flight-Distance AlertsPHONE SCREEN · Seen Apr 2024
  • Rolling Five-Second Flight-Distance AlertsPHONE SCREEN · Seen Apr 2024
  • Overlap-Safe Memory CopyPHONE SCREEN · Seen Aug 2022
  • Maximum Area of IslandPHONE SCREEN · Seen Oct 2021

Similar questions at other companies

  • Merge K Sorted ListsBloomberg LP · PHONE SCREEN · ONSITE INTERVIEWBloomberg LP interview questions
  • Merge K Sorted Linked ListsBharatPe · PHONE SCREEN
  • LRU Cache with TTLAutodesk · ONSITE INTERVIEWAutodesk interview questions
  • Merge k Sorted ListsZS · ONSITE INTERVIEWZS interview questions
  • Merge k Sorted ListsAmazon · PHONE SCREEN · ONSITE INTERVIEW
  • Thread-Safe LRU Cache with TTLLinkedIn · ONSITE INTERVIEWLinkedIn interview questions
  • Merge K Sorted Linked ListsThe Walt Disney Company · OA · ONSITE INTERVIEWThe Walt Disney Company interview questions
  • Reverse Nodes in k-GroupMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
  • Reverse a Linked List in Groups of KExpedia · ONSITE INTERVIEWExpedia interview questions
  • Merge K Sorted Linked Lists Into OneCapital One · ONSITE INTERVIEWCapital One interview questions
All Skydio interview questionsSee Skydio hiring insights
Saved
class Solution {
    public int[] mergeKSortedLists(int[][] lists) {
        // Write your code here.
    }

}
Checking account…