Find Centered Average

Requirements:

Return the "centered" average of an array of ints, which we'll say is the mean average of the values, except ignoring the largest and smallest values in the array. If there are multiple copies of the smallest value, ignore just one copy, and likewise for the largest value. The result should be rounded to the nearest integer.

Assumptions, the array will have a minimum of three elements in it. The elements in the array are in unsorted order.

Example 1:

The array is already sorted for us, we can drop the first and last element, giving us [2,3,4]. The average of this is 3.

Example 2:

We should sort the array first. We can then drop the smallest and largest elements, giving us 1,5,5,7,8. The average of this is 5.2, then rounding, we should return 5.

Example 3:

We should drop the -10 and 0, giving us [-4,-3,-2,-2] The average of this is -2.75, then rounding, we should return -3.

nums:

Please try and complete this project before viewing the solution.