#K56822. Merge Unique Sorted Arrays
Merge Unique Sorted Arrays
Merge Unique Sorted Arrays
You are given two arrays of integers that may include duplicates. Your task is to merge the two arrays into one sorted array with all unique elements.
Formally, if the two arrays are represented as \(A\) and \(B\), you need to output the sorted list of elements from the set \(A \cup B\). That is, all the numbers that appear in one or both arrays, without repetition and in ascending order.
Example:
Input: 1 3 3 5 2 3 6 7</p>Output: 1 2 3 5 6 7
inputFormat
The input consists of two lines:
- The first line contains a sequence of space-separated integers representing the first array. This line may be empty, which represents an empty array.
- The second line contains a sequence of space-separated integers representing the second array. This line may also be empty.
outputFormat
Output a single line containing the space-separated integers of the merged sorted array with all unique elements.
## sample1 3 3 5
2 3 6 7
1 2 3 5 6 7