Skip to content
C

Merge K Sorted Arrays

Mediumjavapythonccppjavascript

Given K sorted arrays, merge them into a single sorted array.

Input Format

The first line contains an integer K. Each of the next K lines describes one array: it starts with its length L, followed by L space-separated integers in non-decreasing order.

Output Format

Print all the values merged into one non-decreasing sequence, separated by single spaces.

Input (stdin)

Output

Run your code to see output here...