Write a method range that accepts an ArrayList of integers as a parameter and that returns the range of values contained in the list, which is defined as 1 more than the difference between the largest and smallest elements. For example if a variable called list stores the following values: [18, 14, 29, 12, 7, 25] The call of range(list) should return 23, because this is one more than the largest difference between any pair of values (29 - 7 + 1 = 23). An empty list is defined to have a range of 0.
Explanation / Answer
public int range(list l){ int min = 999999; int max = -1234569; int i = 0; for(i = 0; i