PROBLEM LINK: Contest
PREREQUISITES: Adhoc, Math, Sorting, Basic I/O
The aim is to find maximum sum by getting maximum difference of any two elements of each array.
SETTER’S SOLUTION: Solution Link
Initialize sum S=0.
Take every array as input and sort it.
Take absolute sum of largest and smallest of array which is first and last element of the array.
Add it to the sum S.