K Max Sum Combinations — Asked in Walmart Interview

Problem Statement :

Sum combination is made by adding one element from array ‘A’ and another element from array ‘B’.

Sample Input:

A : [1, 3]B : [4, 2]K : 2

Sample Output:

7 5

Explanation of Sample Test Case :

5=(3+2), 7=(3+ 4), 3=(1+2), 5=(1+4).

The 2 maximum sum combinations are 7, 5.

Approach :

Time Complexity : O(NlogN)
Space Complexity : O(N)

Code :

Thanks for Reading

Learn more at Placewit. Follow us on Instagram and Facebook for daily learning.

Upskilling students for tech placements!