Absolute value discrepancy (Contest)
Absolute value discrepancy easy Time Limit: 2 sec Memory Limit: 128000 kB
Last updated
Absolute value discrepancy easy Time Limit: 2 sec Memory Limit: 128000 kB
Last updated
Problem Statement :
You are given an array A of size N. For all pairs (i, j) (1 <= i < j <= N), find the maximum value of abs(Ai - Aj) in the array. Input The first line of the input contains a single integer N. The second line of the input contains N space seperated integers.
Constraints: 2 <= N <= 105 1 <= Ai <= 109 Output Print the maximum value of abs(Ai - Aj) in the array. Example Sample Input: 5 7 9 4 1 8
Sample Output: 8
link: