FastPrepMerge Three Sorted Arrays
Problems/Merge Three Sorted Arrays

Merge Three Sorted Arrays

SambaNova Systems logoSambaNova Systems● EasyNEW GRADPHONE SCREEN

Updated Sep 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A firsthand SambaNova phone interview report dated June 3, 2022 asks candidates to merge three sorted arrays and discuss methods and complexity.

You are given three integer arrays that are each sorted in non-decreasing order.

Merge the arrays into one sorted array and remove duplicate values. Return the merged array in non-decreasing order.

Function

mergeThreeSortedArrays(a: int[], b: int[], c: int[]) → int[]

Complete the function mergeThreeSortedArrays in the editor.

mergeThreeSortedArrays has the following parameters:

  1. int a[]: the first sorted array
  2. int b[]: the second sorted array
  3. int c[]: the third sorted array

Returns int[]: the sorted merged array with duplicates removed

Examples

Example 1

a = [1, 3, 5]b = [1, 2, 5, 6]c = [2, 4, 6]return = [1, 2, 3, 4, 5, 6]

After merging all values and removing duplicates, the sorted result is [1, 2, 3, 4, 5, 6].

Example 2

a = []b = [0, 0, 1]c = [1, 2]return = [0, 1, 2]

Empty arrays are allowed. Duplicate 0 and 1 values are returned once.

Constraints

  • Each input array is sorted in non-decreasing order.
  • The arrays may contain duplicate values.
  • The arrays may be empty.

More SambaNova Systems Phone Screen questions

  • Deterministic Zigzag SortPHONE SCREEN · ONSITE INTERVIEW · Seen Jun 2022
  • Minimum Window SubstringPHONE SCREEN · Seen Jun 2022
  • Number of ProvincesPHONE SCREEN · Seen Jun 2022
  • Task Scheduler with CooldownPHONE SCREEN · ONSITE INTERVIEW · Seen Jun 2022
  • Point Inside a TrianglePHONE SCREEN · ONSITE INTERVIEW · Seen Jun 2022
  • Parse Variable, Expression, and Application TreesPHONE SCREEN · ONSITE INTERVIEW · Seen Mar 2022
  • Decode StringPHONE SCREEN · Seen Mar 2022
  • Insert, Delete, and Get Random in Constant TimePHONE SCREEN · Seen Mar 2022
  • Ugly NumberPHONE SCREEN · ONSITE INTERVIEW · Seen Apr 2021
  • Diagonal TraversePHONE SCREEN · Seen Nov 2020

Similar questions at other companies

  • Merge Three Sorted ArraysMeta · PHONE SCREEN · ONSITE INTERVIEWMeta interview questions
  • Top K TradesJane Street · PHONE SCREENJane Street interview questions
  • Top K Largest Values with Constant Auxiliary SpaceBAMTECH Media · PHONE SCREEN
  • Top K Frequent ElementsAmazon · OA · PHONE SCREEN
  • 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
  • Median Across Sorted ArraysGoogle · PHONE SCREENGoogle interview questions
  • Select the Top User MatchesDuolingo · PHONE SCREENDuolingo interview questions
  • Meeting Rooms IIQuince · PHONE SCREENQuince interview questions
All SambaNova Systems interview questionsSee SambaNova Systems hiring insights
Saved
class Solution {
    public int[] mergeThreeSortedArrays(int[] a, int[] b, int[] c) {
      // write your code here
    }
}
Checking account…