#K63757. Minimum Absolute Difference
Minimum Absolute Difference
Minimum Absolute Difference
You are given an array of n integers. Your task is to determine the minimum absolute difference between any two distinct elements in the array.
The absolute difference between two integers a and b is given by \(|a-b|\). To solve this problem, you should sort the array first and then consider the consecutive differences.
Input Constraints:
- 1 \(\leq n \leq 10^5\)
- Each integer in the array lies within the range \(-10^9\) to \(10^9\).
Example:
Input: 5 3 8 15 1 7</p>Output: 1
inputFormat
The first line contains an integer n, denoting the number of elements in the array. The second line contains n space-separated integers representing the elements of the array.
outputFormat
Output a single integer which is the minimum absolute difference between any two elements in the array.
## sample5
3 8 15 1 7
1
</p>