You are given an array \(A\) of size \(N\). You have to select any value '\(x\)' from \(A\) and remove its all occurrences. You need to perform this operation exactly once.
You need to obtain the maximum possible final sum of \(A\).
Input format
- First line: A number \(T\) denoting the total number of test cases
For each test case:
- First line: A number \(N\) denoting size of \(A\)
- Next line: \(N\) space-separated integers denoting the array \(A\)
Output format
Print the maximum possible sum of \(A\) after performing the operation exactly once.
Constraints
\(1 \le T \le 10\)
\(1 \le N \le 10^5\)
\(1 \le A[i] \le 10^6\)
In testcase 1, x = 1. So, sum is 3. This is maximum sum that can be obtained.
In testcase 2, x = 1. So, sum is 5. This is maximum sum that can be obtained.
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor