#K85297. Minimum Absolute Difference
Minimum Absolute Difference
Minimum Absolute Difference
Given an array of integers, find the minimum absolute difference between any two distinct elements. In other words, for an array \( A \) of size \( n \), calculate \[ \min_{1 \le i < j \le n} |A_i - A_j| \] where \( A_i \) and \( A_j \) are distinct elements of the array. The array may contain negative values, and it is guaranteed that \( n \ge 2 \). Your solution should be efficient enough to handle large inputs.
inputFormat
The first line contains an integer ( n ) representing the number of elements in the array. The second line contains ( n ) space-separated integers which are the elements of the array.
outputFormat
Print a single integer which is the minimum absolute difference between any two elements in the array.## sample
5
3 -7 0 -4 1
1
</p>