EASY SOLUTION 💯 || Commented Code ✨
Intuition: \n Describe your first thoughts on how to solve this problem. \nBy using heaps, we ensure that the process of finding and pairing the smallest and la
# Intuition: \n<!-- Describe your first thoughts on how to solve this problem. -->\nBy using heaps, we ensure that the process of finding and pairing the smallest and largest elements is efficient .\n\n\n# Complexity\n- Time complexity: O(N logN)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n\n# Code\n```\nclass Solution {\npublic:\n    double minimumAverage(vector<int>& nums) {\n        // Vector to store the averages\n        vector<double> v;\n        \n        // Min-heap to get the smallest elements\n        priority_queue<int, vector<int>, greater<int>> minh;\n        \n        // Max-heap to get the largest elements\n        priority_queue<int, vector<int>, less<int>> maxh;\n        \n        // Size of the input vector\n        int n = nums.size();\n        \n        // Push all elements of nums into both heaps\n        for(int i = 0; i < n; i++) {\n            minh.push(nums[i]);\n            maxh.push(nums[i]);\n        }\n        \n        // Iterate over half of the elements (n / 2 times)\n        for (int i = 0; i < n / 2; ++i) {\n            // Get the smallest element from the min-heap\n            int minele = minh.top();\n            minh.pop();\n            \n            // Get the largest element from the max-heap\n            int maxele = maxh.top();\n            maxh.pop();\n            \n            // Push the average of the smallest and largest elements into vector v\n            v.push_back((minele + maxele) / 2.0);\n            \n            // Pop the next smallest and largest elements\n            minh.pop();\n            maxh.pop();\n        }\n        \n        // Find the minimum value in vector v\n        double ans = *min_element(v.begin(), v.end());\n        \n        // Return the minimum average\n        return ans;\n    }\n};\n```
['C++']