
'N' = 3, ‘X' = [1,2,1]
If we rearrange our array 'X' to '[2, 1, 1]' .
Then our answer will be (0-2)^2 + (1-1)^2 + (1-2)^2 = 4 + 0 + 1 = 5.
For array ‘[1, 1, 2]’ value will be equal to ‘1 + 0 + 0 = 1’.
For array ‘[1, 2, 1]’ value will be equal to ‘1 + 1 + 1 = 3’.
The first line contains an integer 'T', which denotes the number of test cases to be run. Then the test cases follow.
The first line of each test case contains an integer 'N’.
The second line contains N integers, denoting the array ‘X’ value.
For each test case, return the maximum array value for the given array ‘X’.
You don’t need to print anything. It has already been taken care of. Just implement the given function.
1 <= T <= 10
1 <= N <= 10^4
1<= X[i] <= 10^5
Time Limit: 1 sec