Merge Two Sorted Arrays
Submissions: 17434   Accuracy:

25.21%

  Difficulty: Easy

You have to merge the two sorted arrays into one sorted array (in non-increasing order)

Input:

First line contains an integer T, denoting the number of test cases.
First line of each test case contains two space separated integers X and Y, denoting the size of the two sorted arrays.
Second line of each test case contains X space separated integers, denoting the first sorted array P.
Third line of each test case contains Y space separated integers, denoting the second array Q.


Output:

For each test case, print (X + Y) space separated integer representing the merged array.


Constraints:

1 <= T <= 100
1 <= X, Y <= 5*104
0 <= Pi, Qi <= 109


Example:

INPUT:

1
4 5
7 5 3 1
9 8 6 2 0

OUTPUT:

9 8 7 6 5 3 2 1 0

** For More Input/Output Examples Use 'Expected Output' option **

Author: shubham54


Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.