easy solution
Intuition\nThe problem requires finding the smallest average after repeatedly removing the smallest and largest elements from an array and averaging them. This 
# Intuition\nThe problem requires finding the smallest average after repeatedly removing the smallest and largest elements from an array and averaging them. This suggests that the sorted order of the elements is important, as the smallest and largest elements need to be easily accessed.\n\n# Approach\n1. **Sort the Array:** Sort the given array `nums` to facilitate easy access to the smallest and largest elements.\n2. **Initialize Pointers:** Use two pointers, `i` starting from the beginning (smallest element) and `j` starting from the end (largest element) of the sorted array.\n3. **Compute Averages:** Repeatedly remove the smallest and largest elements by incrementing `i` and decrementing `j`, compute their average, and store it in the `averages` array.\n4. **Find Minimum Average:** Sort the `averages` array and return the first element, which will be the smallest average.\n\n# Complexity\n- **Time complexity:**\n  - Sorting the array takes $$O(n \\log n)$$.\n  - Finding averages requires $$O(n/2)$$ operations.\n  - Sorting the averages array takes $$O(n \\log n)$$ again.\n  - Overall time complexity: $$O(n \\log n)$$.\n\n- **Space complexity:**\n  - The `averages` array requires $$O(n/2)$$ space.\n  - Overall space complexity: $$O(n)$$.\n\n# Code\n```\nclass Solution {\npublic:\n    double minimumAverage(vector<int>& nums) {\n        sort(nums.begin(), nums.end()) ;\n        vector<double> averages ;\n        int i=0, j=nums.size()-1 ;\n        while(i < j){\n            double avg = (double)(nums[i++] + nums[j--])/2 ;\n            averages.push_back(avg) ;\n        }\n        sort(averages.begin(), averages.end()) ;\n        return averages[0] ;\n    }\n};\n```
['C++']