1ms 100% beat in java very easiest code 😊.
Code
![94da60ee-7268-414c-b977-2403d3530840_1725903127.9303432.png](https://assets.leetcode.com/users/images/37a02197-6c89-4754-bd1e-7e483cba7649_1736413476.3246448.png)


# Code
```java []
class Solution {
    public double minimumAverage(int[] nums) {
        double ans = Double.MAX_VALUE;
        for (int i = 0; i < nums.length/2; i++) {
            int min = Integer.MAX_VALUE, max = Integer.MIN_VALUE;
            for (int j = 0; j < nums.length; j++) {
                // Check if the current element is not equal to -1
                if (nums[j] > -1) {
                    if (min > nums[j]) {
                        min = nums[j]; // Update minimum if current element is smaller
                    }
                    if (max < nums[j]) {
                        max = nums[j]; // Update maximum if current element is larger
                    }
                }
            }
            double dMin = min; // Convert min to double
            double dMax = max; // Convert max to double
            if (ans > (dMin + dMax) / 2) {
                ans = (dMin + dMax) / 2; // Update the answer with the average of min and max
            }
            // Set the first occurrence of min to -1
            for (int j = 0; j < nums.length; j++) {
                if (nums[j] == min) {
                    nums[j] = -1;
                    break;
                }
            }   
            // Set the first occurrence of max to -1
            for (int j = 0; j < nums.length; j++) {
                if (nums[j] == max) {
                    nums[j] = -1;
                    break;
                }
            }
        }
        return ans;
    }
}
```
['Java']