#K1656. Maximum Altitude Difference
Maximum Altitude Difference
Maximum Altitude Difference
Given a sequence of altitudes, your task is to determine the maximum difference in altitude between any two points. The altitude difference is defined as the difference between the maximum and minimum altitudes in the sequence.
Input Format: The first line of input contains a single integer n representing the number of points. The second line contains n space-separated integers, each representing the altitude at a point.
Output Format: Output a single integer that represents the maximum altitude difference.
For example, if the input is:
5 300 450 200 500 100
Then the output should be:
400
inputFormat
The first line contains an integer n
, the number of points. The second line contains n
space-separated integers representing the altitudes.
outputFormat
Output a single integer representing the maximum difference between any two altitudes.
## sample5
300 450 200 500 100
400
</p>