FastPrepMerge Multiple Sorted Streams
Problems/Merge Multiple Sorted Streams

Merge Multiple Sorted Streams

NVIDIA logoNVIDIA● MediumFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an NVIDIA phone screen for a full-time role. The original report goes from merging two sorted lists to merging two oversized sorted files, and then many. It leaves out how the streams are passed in, the exact output rules, and the limits. We filled those in.

Our version is about 91% the same as the reported question.

You are given streams, where each inner array is an independently sorted stream of integers in nondecreasing order. Merge every value from every stream into one nondecreasing array.

Preserve every occurrence, including duplicates. Empty streams are valid. Process the inputs as independent ordered streams rather than concatenating and sorting all values again.

Function

mergeSortedStreams(streams: int[][]) → int[]

Examples

Example 1

streams = [[1,4,7],[2,2,9],[3,8]]return = [1,2,2,3,4,7,8,9]

The next smallest available head is selected until every stream is exhausted. Both copies of 2 remain in the result.

Example 2

streams = [[],[-5,0,6],[1],[1,10]]return = [-5,0,1,1,6,10]

Empty streams contribute nothing, and equal values from different streams are both preserved.

Example 3

streams = []return = []

With no streams, the merged result is empty.

Constraints

  • 0 <= streams.length <= 100
  • 0 <= streams[i].length
  • The total number of values across all streams is at most 100000.
  • -1000000000 <= streams[i][j] <= 1000000000
  • Every inner array is sorted in nondecreasing order.

More NVIDIA Phone Screen questions

  • Network Layer Execution OrderPHONE SCREEN · Seen Nov 2026
  • Paged KV Cache AccessPHONE SCREEN · Seen Nov 2026
  • Sliding Window Attention over a KV CachePHONE SCREEN · Seen Nov 2026
  • Summarize Server Healthcheck LogsPHONE SCREEN · Seen Oct 2026
  • Hash Partition OffsetsPHONE SCREEN · Seen Oct 2026
  • Filter Paginated Medical RecordsPHONE SCREEN · Seen Oct 2026
  • Least Frequently Used CachePHONE SCREEN · Seen Oct 2026
  • Parallel String Counts with a Custom Hash TablePHONE SCREEN · Seen Oct 2026
  • Simulate a Reference-Counted Smart PointerPHONE SCREEN · Seen Aug 2026
  • Streaming Top-K Frequent ElementsPHONE SCREEN · Seen Aug 2026

Similar questions at other companies

  • Top K Frequent ElementsAmazon · OA · PHONE SCREEN · ONSITE INTERVIEW
  • Mutual-Friend RecommendationsMeta · PHONE SCREEN · ONSITE INTERVIEWMeta interview questions
  • Tennis Court SchedulingAtlassian · PHONE SCREEN · ONSITE INTERVIEWAtlassian interview questions
  • Maximum Number of Events That Can Be AttendedByteDance · PHONE SCREENByteDance interview questions
  • Meeting Rooms IIeBay · PHONE SCREENeBay interview questions
  • Select the Top User MatchesDuolingo · PHONE SCREENDuolingo interview questions
  • Meeting Rooms IIQuince · PHONE SCREENQuince interview questions
  • Kth Largest Element in an ArrayLinkedIn · PHONE SCREENLinkedIn interview questions
  • Meeting Rooms IISecuronix · PHONE SCREEN
  • Maximum Number of Events That Can Be AttendedSnowflake · PHONE SCREENSnowflake interview questions

NVIDIA interview experiences

  • NVIDIA Full-Time SWE Onsite Scheduling: 1 Experience
  • NVIDIA OA: What It Tests (2026)
  • NVIDIA DevOps, QA and Infra Intern Interviews: 12 Experiences
  • NVIDIA Ignite Internship OA Experience
  • NVIDIA Software Intern Interview Questions: 9 Experiences
  • NVIDIA Ignite SWE Intern OA Questions: 6 Experiences
All NVIDIA interview questionsSee NVIDIA hiring insights
Saved
class Solution {
    public int[] mergeSortedStreams(int[][] streams) {
        // Write your solution here
    }
}
Checking account…