Merge K Sorted Arrays Problem Statement
You are provided with 'K' different arrays/lists, each sorted in ascending order. Your task is to merge all these arrays/lists into one sorted array/list in ascending order.
Input:
The first line contains an integer T, indicating the number of test cases.
The first line of each test case contains an integer K, the number of arrays/lists.
The following 2*K lines for each test case include:
- A line with an integer N, representing the size of that array.
- A line with N space-separated integers denoting the elements of the array.
Output:
The output consists of a single line for each test case, containing space-separated elements of the merged and sorted array.
Example:
Input:
T = 1
K = 2
Array 1: N = 3, Elements = [1, 3, 5]
Array 2: N = 4, Elements = [2, 4, 6, 8]
Output:
1 2 3 4 5 6 8
Constraints:
- 1 <= T <= 5
- 1 <= K <= 5
- 1 <= N <= 20
- -105 <= DATA <= 105
- Time limit: 1 sec
Note:
The printing of the output has been handled. You only need to implement the function.
Be the first one to answer
Add answer anonymously...
Top Bounteous x Accolite Software Developer interview questions & answers
Popular interview questions of Software Developer
Top HR questions asked in Bounteous x Accolite Software Developer
>
Bounteous x Accolite Software Developer Interview Questions
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app