#K43057. Taco Array Operation
Taco Array Operation
Taco Array Operation
You are given an integer array of size n containing positive integers. You must perform exactly one operation on the array: choose two distinct indices i and j (with 1 ≤ i, j ≤ n and i ≠ j) and add the value of the element at index j to the element at index i. Your task is to compute the maximum possible value of any element in the array after this one operation.
Note: Since you are allowed only one operation per test case, the best strategy is to add the two largest numbers in the array.
Mathematical Formulation:
If the array sorted in non-decreasing order is \(a_1 \le a_2 \le \cdots \le a_n\), then the answer is \(a_{n-1} + a_n\).
inputFormat
The first line of input contains a single integer T (1 ≤ T ≤ 104), representing the number of test cases. Each test case is described as follows:
- The first line of each test case contains a single integer n (2 ≤ n ≤ 105), the number of elements in the array.
- The second line contains n space-separated positive integers representing the elements of the array.
It is guaranteed that the sum of n over all test cases does not exceed 106.
outputFormat
For each test case, output a single integer - the maximum possible value of any element in the array after performing exactly one operation, on a separate line.
## sample1
4
3 8 2 5
13
</p>