Chandu and his Girlfriend Returns
Practice
3.4 (194 votes)
Algorithms
Approved
Easy
Open
Ready
Problem
91% Success 17727 Attempts 20 Points 2s Time Limit 256MB Memory 1024 KB Max Code

In the previous problem Chandu bought some unsorted arrays and sorted them (in non-increasing order). Now, he has many sorted arrays to give to his girlfriend. But, the number of sorted arrays are very large so Chandu decided to merge two sorted arrays into one sorted array. But he is too lazy to do that. So, he asked your help 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 N and M, denoting the size of the two sorted arrays.
Second line of each test case contains N space separated integers, denoting the first sorted array A.
Third line of each test case contains M space separated integers, denoting the second array B.

Output:
For each test case, print (N + M) space separated integer representing the merged array.

Constraints:
1 <= T <= 100
1 <= N, M <= 5*104
0 <= Ai, Bi <= 109

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
21 votes
Tags:
AlgorithmsEasyJune Easy 19Logic-BasedMerge sortSorting
Points:20
32 votes
Tags:
ApprovedData StructuresEasyOpen
Points:20
87 votes
Tags:
Easy