← 返回 meta 的题目列表Merge Three Sorted Arrays into Unique Sorted Array in Linear Time
类型:online_judge
meta
Merge three sorted arrays into a single sorted array, where any duplicate numbers only appear once in the final sorted array. Requires linear time complexity.
Input:
Three integer arrays, each sorted.
Output: Return an array that is sorted in ascending order containing all unique elements from the input arrays.
Example:
Input:
array1 = [-100, -20, 0, 0, 0, 1, 2, 10]
array2 = [-90, -1, 0, 0, 2, 3]
array3 = [-20, -10, 0, 1, 1, 3, 20, 30]
Output:
[-100, -90, -20, -10, -1, 0, 1, 2, 3, 10, 20, 30]
Requires linear time complexity.
Example
Input
-100 -20 0 0 0 1 2 10
-90 -1 0 0 2 3
-20 -10 0 1 1 3 20 30