Range of an Array
The range of a list is the difference between its largest and smallest value. Print the range of the given list.
Input: the first line has an integer N; the second line has N integers separated by spaces.
Output: one integer — max − min.
Constraints:
- 1 ≤ N ≤ 2000
- −109 ≤ ai ≤ 109
Sample Tests
Input 1
4 7 2 9 4
Output 1
7
Input 2
1 100
Output 2
0
Discussion (opens after you solve — no spoilers before)
No comments yet.