#K66572. Maximum Absolute Difference
Maximum Absolute Difference
Maximum Absolute Difference
In this problem, you are given an array of integers. Your task is to compute the maximum absolute difference between any two elements in the array. In other words, if ( arr ) is the input array, you need to find the value [ |\max(arr) - \min(arr)|, ] which represents the absolute difference between the maximum and minimum elements. If the array is empty or contains only one element, the answer is 0.
The input is provided via standard input, and the answer should be printed to standard output.
inputFormat
The first line of input contains a single integer ( n ) representing the number of elements in the array. The second line of input contains ( n ) space-separated integers. If ( n = 0 ), the array is considered empty.
outputFormat
Output a single integer which is the maximum absolute difference between any two elements in the array.## sample
4
1 2 3 4
3
</p>