#K14136. Maximum Sum After Single Deletion
Maximum Sum After Single Deletion
Maximum Sum After Single Deletion
Your task is to process multiple test cases where you are given an array of integers for each test case. For each array, you must remove exactly one element such that the sum of the remaining elements is maximized. The key observation is that removing the smallest element will yield the maximum possible sum.
Mathematically, if an array A contains N integers, then the result is computed as:
You need to implement the solution such that it reads input from standard input (stdin) and writes output to standard output (stdout).
inputFormat
The first line contains an integer T representing the number of test cases. For each test case, the first number is an integer N, denoting the number of elements in the array. The next N space-separated integers represent the elements of the array.
Input is provided via standard input (stdin).
outputFormat
For each test case, output a single line containing the maximum sum obtainable by deleting exactly one element from the array.
Output should be printed to standard output (stdout).
## sample3
3
1 2 3
4
-1 -2 -3 -4
5
1 -2 3 -4 5
5
-6
7
</p>