Question: Given n arrays, each array contain n positive integers. Write an O(n^{2} log(n)) algorithm to find the smallest n sums out of n^{n} possible sums
Given n arrays, each array contain n positive integers. Write an O(n^{2} log(n)) algorithm to find the smallest n sums out of n^{n} possible sums that can be obtained by picking one positive integer from each of n arrays. For example, given three arrays as follows: [5, 1, 8] , [5, 2, 9] , and [6, 7, 10]. The smallest n sums of the given array is [9, 10, 12].
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
