Union Of Two Arrays

easy
1. You are given two arrays with N and M distinct elements. 2. You have to find the union between these two arrays. 3. Union of the two arrays can be defined as the set containing distinct elements from both the arrays. If there are repetitions, then only one occurrence of an element should be present in the union. 4. display is a utility function, feel free to use it for debugging purposes. 5. main takes input from the users and creates the arrays. 6. This is a functional problem. 7. You have to complete the union function. It takes as input both the arrays. It should return an array representing the union of two arrays. 8. Don't change the code of main and display.

Input Format

First line takes input N, the length of the first array. Second line takes input N space separated numbers representing the elements of first array. Third line takes input M, the length of the second array. Fourth line takes input M space separated numbers representing the elements of second. Input is handled for you.

Output Format

Union array in sorted order. Output is handled for you.

Constraints

1 <= N, M <= 30000

Notice

Try First, Check Solution later

1. You should first read the question and watch the question video.
2. Think of a solution approach, then try and submit the question on editor tab.
3. We strongly advise you to watch the solution video for prescribed approach.

Example

Input
6 
1 3 5 7 9 11 
4 
1 2 3 4
Output
1 2 3 4 5 7 9 11
Previous
Uncommon Words From Two Sentences
Next
Valid Sudoku

Related Questions