Problem Brief
Merge Three Sorted Arrays
FULLTIMEPHONE SCREEN
See Meta online assessment and hiring insightsYou 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 Description
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
1Example 1
Input
a = [1, 3, 5], b = [1, 2, 5, 6], c = [2, 4, 6]
Output
[1, 2, 3, 4, 5, 6]
Explanation
After merging all values and removing duplicates, the sorted result is [1, 2, 3, 4, 5, 6].
2Example 2
Input
a = [], b = [0, 0, 1], c = [1, 2]
Output
[0, 1, 2]
Explanation
Empty arrays are allowed. Duplicate 0 and 1 values are returned once.
Constraints
Limits and guarantees your solution can rely on.
- Each input array is sorted in non-decreasing order.
- The arrays may contain duplicate values.
- The arrays may be empty.