1.You are given two sorted arrays arr[] and brr[] of size N and M respectively. 2.You have to find the union of these two arrays. 3.Union of two arrays can be defined as the common and distinct elements in the two arrays. 4.You have to complete the function printUnion() that should print the union the union of two sorted array.
Input Format
First line contains two space separated integers 'm' and 'n'. Second line contains 'n' space separated integers. Third line contains 'm' space separated integers.
Output Format
Print the union of two sorted array
Constraints
1<=N<=10^6 1<=M<=10^6
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
5 3 1 2 3 4 5 1 2 3
Output
1 2 3 4 5