Merge Three Sorted Arrays
Updated
Problem statement
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:
int a[]: the first sorted arrayint b[]: the second sorted arrayint 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 Meta Phone Screen questions
- Convert a Sorted Linked List to a Balanced BSTPHONE SCREEN · Seen Nov 2026
- Fuzzy Word Lookup With One Misspelled LetterPHONE SCREEN · Seen Nov 2026
- Multi-Head Attention Forward PassPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Run-Length Encoded Vector Dot ProductPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Mutual-Friend RecommendationsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Best Time to Buy and Sell StockPHONE SCREEN · Seen Nov 2026
- First Element Greater Than KPHONE SCREEN · Seen Nov 2026
- Count Events in Rolling Minute WindowsPHONE SCREEN · Seen Oct 2026
- Valid Word AbbreviationPHONE SCREEN · Seen Oct 2026
- Shortest Path in a Binary MatrixPHONE SCREEN · Seen Sep 2026
Similar questions at other companies
- Top K TradesJane Street · PHONE SCREENJane Street interview questions
- Merge Three Sorted ArraysSambaNova Systems · PHONE SCREENSambaNova Systems interview questions
- Fourth Largest Element in an ArrayBank of America · ONSITE INTERVIEWBank of America interview questions
- Top K Largest Values with Constant Auxiliary SpaceBAMTECH Media · PHONE SCREEN
- Top K With a Deterministically Noisy Comparator (MLE)Mercor · ONSITE INTERVIEWMercor interview questions
- Top K Frequent ElementsAmazon · OA · PHONE SCREEN · ONSITE INTERVIEW
- Tennis Court SchedulingAtlassian · PHONE SCREEN · ONSITE INTERVIEWAtlassian interview questions
- Retrieve Vectors by Cosine SimilarityHarvey · ONSITE INTERVIEWHarvey interview questions
- Maximum Number of Events That Can Be AttendedByteDance · PHONE SCREENByteDance interview questions
- Meeting Rooms IIeBay · PHONE SCREENeBay interview questions
Meta interview experiences
- Meta PhD SWE Intern AI Coding Phone Screen: 1 Experience
- Meta Business Support Engineer Phone Screen: 1 Experience
- Meta Software Engineer Onsite Questions: 3 Experiences
- Meta AI Native Engineer OA and Onsite: 1 Experience
- Meta AI-Native Coding Interview: 3 Experiences
- Meta Production Engineer Intern Questions: 6 Experiences