Mediumtwo-pointersarrayssorting
Merge Sorted Arrays
Time limit 2 s · Memory 64 MBAcceptance: —Solved by: 0
Statement
The first line contains n, the second line contains n integers in non-decreasing order; the third line contains m, the fourth line contains m integers in non-decreasing order. Print all n + m numbers in non-decreasing order on one line separated by spaces.
Examples
Example 1
Input
3 1 4 7 3 2 5 6
Output
1 2 4 5 6 7
Example 2
Input
2 1 2 2 1 2
Output
1 1 2 2
Constraints
- 1 ≤ n, m ≤ 10^5
- -10^9 ≤ a_i, b_i ≤ 10^9