


Input: 'N' = 3, ‘ARR’ = [1, 2, 3]
Output: 3
It is possible to make all elements of the given array equal by three moves only. There is no possible solution that can perform the task in minimum moves than 3.
[1, 2, 3] => [2, 3, 3] => [3, 4, 3] => [4, 4, 4]
The first line of input contains an integer 'T', denoting the number of test cases.
For each test case, the first line contains a single integer 'N' number of array elements, and the next line contains 'N' elements the array elements.
For each test case, print the minimum number of moves needed to make all array elements equal.
Output for each test case will be printed in a separate line.
You don't need to print anything. It has already been taken care of. Just implement the given function.
1 <= ‘T’ <= 10
2 <= 'N' <= 10^4
0 <= 'ARR[i]'<= 10^9
Adding 1 to all elements does not change anything in terms of equality. So we must find the minimum number of moves. The only way to make all elements equal this way is to make them equal to the array's minimum element.
Hence, the minimum number of moves will be equal to the sum of whole array elements - 'N' * min_element.
Algorithm :