#B3664. Maximum Distance Between Adjacent Snack Points
Maximum Distance Between Adjacent Snack Points
Maximum Distance Between Adjacent Snack Points
Logu Corporation has an infinitely long road which can be regarded as a number line. On this road, there are \(k\) snack selling points with coordinates \(a_1,a_2,\dots,a_k\). Aya, who is very fond of snacks, wishes to determine the maximum distance between any two adjacent selling points when they are arranged in order of increasing coordinate. The distance between the \(i\)th and \(j\)th selling point is defined as \(|a_i - a_j|\), where the absolute value function is defined as:
[ |x| = \begin{cases} x, & \text{if } x \ge 0, \ -x, & \text{if } x < 0. \end{cases} ]
For example, \(|4| = 4\), \(|0| = 0\), and \(|-1| = 1\). Your task is to calculate the maximum distance between two consecutive snack selling points.
inputFormat
The first line contains an integer \(k\) (at least 2), the number of snack selling points. The second line contains \(k\) space-separated integers \(a_1,a_2,\dots,a_k\) representing the coordinates of the selling points.
outputFormat
Output a single integer representing the maximum distance between any two adjacent snack selling points after sorting them in increasing order.
sample
5
1 5 9 13 16
4
</p>