🚀 Sort and simple solution beat 100% users ✅
\n\n# Complexity\n- Time complexity:\n $O(n)$\n\n- Space complexity:\n$O(n)$\n\n# Code\n\nclass Solution {\npublic:\n    double minimumAverage(vector<int>& nums
\n\n# Complexity\n- Time complexity:\n $O(n)$\n\n- Space complexity:\n$O(n)$\n\n# Code\n```\nclass Solution {\npublic:\n    double minimumAverage(vector<int>& nums, vector<double> ans = {}) {\n        sort(nums.begin(), nums.end());\n        while (!nums.empty()) {\n            double l = *nums.begin();   nums.erase(nums.begin());\n            double r = nums.back();     nums.pop_back();\n            ans.push_back((l + r) / 2.0);\n        }\n        return *min_element(ans.begin(), ans.end());\n    }\n};\n```
['C++']