Java Solution using Deque
IntuitionApproachComplexity
Time complexity: O(NLogN)

Space complexity: O(N)
Code
# Intuition


# Approach


# Complexity
- Time complexity: **O(NLogN)**
<!-- 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) {
        
        int n = nums.length;
        double ans =Integer.MAX_VALUE ;
        
        Deque<Integer> dq = new ArrayDeque<>();
        Arrays.sort(nums);

        for(int num:nums){
            dq.add(num);
        }
      
        while(!dq.isEmpty()){
            int a =  dq.removeFirst();
            int b =  dq.removeLast();
            double avg = (a+b)/2.0;
            ans = Math.min(ans,avg);
        }
        
       return ans;
    }
}
```
['Java']