Question: Please code in C++ or Java as soon as possible. Please code and output should be as shown in above image. You are given a
Please code in C++ or Java as soon as possible.


Please code and output should be as shown in above image.
You are given a sequence A1, A2, ..., An. Find the maximum value of the expression |AL Ayl + Ay A2|+|A, Az| over all triples of pairwise distinct valid indices (x, y, z). Input The first line of the input contains a single integer T denoting the number of test cases. The description of T test cases follows. The first line of each test case contains a single integer N. The second line contains N space-separated integers A1, A2, ..., AN- Output For each test case, print a single line containing one integer -- the maximum value of |A, Ayl + [Ay Ay] + A, Azl. Constraints . 1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
