Problem Description
Given two integers arrays A and B of size N each.
Find the maximum N elements from the sum combinations (Ai + Bj) formed from elements in array A and B.
1 <= N <= 2 * 105
-1000 <= A[i], B[i] <= 1000
First argument is an integer array A.
Second argument is an integer array B.
Return an intger array denoting the N maximum element in descending order.
Input 1:
A = [1, 4, 2, 3] B = [2, 5, 1, 6]
Input 2:
A = [2, 4, 1, 1] B = [-2, -3, 2, 4]
Output 1:
[10, 9, 9, 8]
Output 2:
[8, 6, 6, 5]
Explanation 1:
4 maximum elements are 10(6+4), 9(6+3), 9(5+4), 8(6+2).
Explanation 2:
4 maximum elements are 8(4+4), 6(4+2), 6(4+2), 5(4+1).
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a question? Checkout Sample Codes for more details.