Combine Many Pre-Sorted Lists Into One

Algorithm · C3.ai · Medium

You are given k arrays of integers. Each array is already sorted in non-decreasing order. Combine all of them into a single array that is also sorted in non-decreasing order, and return it. Any of the input arrays may be empty. The number of arrays, k, may also be very large, so your approach should handle a large number of input arrays well. Examples Example

Loading the rest of the question…