Given N and an array of length 3*N.
You have to remove exactly N elements from this array.
From the remaining array of length 2N, assuming S1 is the sum of first N elements and S2 is the sum of remaining N elements, what is ths maximum possible value of S1 - S2 we can get.
Example:
N = 2, A = [3,1,5,2,1,1]
remove 2 and 1 array will become 3,5,1,1
and ans is (3+5)-(1+1) = 6N = 2, A = [1,2,5,3,5,1]
remove 1, 5 and array will become 2,5,3,1
ans will be (2+5)-(3+1) = 3N = 2, A = [1,2,5,3,1,1]
remove 1, 2 and array will become 5,3,1,1
ans will be (5+3)-(1+1) = 6Comments (3)


