Algorithm · Ebay · Medium
Problem Given m arrays of integers already sorted in non-decreasing order, and an integer K, return the K smallest values from all arrays combined, also in non-decreasing order. Avoid building a min-heap that contains every element at the start. Instead, make use of the fact that each individual array is already sorted. Function Signature Input arrays: the m input arrays, each sorted in non-decreasing order. K: the number of smallest combined elements to return. Output…
Checking your access…