Easiest Java Solution | Simple & Clear Approach
IntuitionThe problem revolves around repeatedly removing the smallest and largest elements from the array, then computing their average. Since we're tasked with
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
The problem revolves around repeatedly removing the smallest and largest elements from the array, then computing their average. Since we're tasked with finding the minimum average from all such pairs, it’s clear that we need an approach that efficiently tracks both the minimum and maximum values in each iteration.

The key insight is that the minimum average will likely occur when the smallest and largest numbers are closest together, reducing the average value.

# Approach
<!-- Describe your approach to solving the problem. -->
# 1)Convert the Array to a List:
This allows for easy removal of elements after processing each min-max pair.

# 2)Iterate n/2 Times:

# Find the Minimum and Maximum: 
Use Collections.min() and Collections.max() to identify the smallest and largest elements in the current list.
# Compute the Average: 
Calculate (min + max) / 2.0 to ensure floating-point division.
# Store the Average:
 Add the computed average to a separate list for tracking.
# Remove Elements:
 Remove the identified min and max elements from the list.
# Final Step:
After processing all pairs, return the smallest average from the list using Collections.min().

# Complexity
- Time complexity:O(n²)
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity: O(n)
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```java []
class Solution {
    public double minimumAverage(int[] nums) {
         ArrayList<Double> averageList = new ArrayList<>();
        ArrayList<Integer> numlist= new ArrayList<>();
        
        for (int num : nums) {
            numlist.add(num);
        }

        int n = nums.length;
        for (int i = 0; i < n / 2; i++) {
            int min = Collections.min(numlist); 
            int max = Collections.max(numlist); 

           
            numlist.remove(Integer.valueOf(min));
            numlist.remove(Integer.valueOf(max));

           
            double average = (min + max) / 2.0;
            averageList.add(average);
        }

        
        return Collections.min(averageList);
        
    }
}
```
['Java']