minimum-average-of-smallest-and-largest-elements
IntuitionApproachComplexity

Time complexity:
O(NlogN)


Space complexity:
O(N)

Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
O(NlogN)

- Space complexity:
O(N)

# Code
```java []
class Solution {
    public double minimumAverage(int[] nums) {
          double ans=Integer.MAX_VALUE;
        Arrays.sort(nums);


        int i=0;
        int j=nums.length-1;

        while (i<j) {
            double avg=((double)(nums[i]+nums[j]))/2;
            ans=Math.min(ans,avg);

            i++;
            j--;
        }


        return ans;
    }
}
```
['Java']