#K6316. Maximum Trail Steepness
Maximum Trail Steepness
Maximum Trail Steepness
You are given a sequence of altitude measurements along a trail. Your task is to determine the maximum steepness of the trail. The steepness is defined as the maximum absolute difference between two consecutive altitude points.
Formally, given a sequence \(a_1, a_2, \dots, a_n\), the maximum steepness is defined as
$$\max_{2 \leq i \leq n} |a_i - a_{i-1}|$$
Calculate and output the maximum steepness.
inputFormat
The first line of input contains an integer (n) representing the number of altitude points. The second line contains (n) space-separated integers, where each integer represents the altitude at a given point on the trail.
outputFormat
Output a single integer representing the maximum steepness of the trail. The maximum steepness is defined as (\max_{2 \leq i \leq n} |a_i - a_{i-1}|).## sample
5
1 3 6 2 8
6