Simple Short code | C++
Approach and Intuition\n1. Sorting the Input: First, the input vector nums is sorted. This helps in pairing the smallest and largest remaining elements to minim
# Approach and Intuition\n1. Sorting the Input: First, the input vector nums is sorted. This helps in pairing the smallest and largest remaining elements to minimize the average of each pair.\n\n2. Pairing and Averaging:\n\nUse two pointers: s starting at the beginning of the sorted vector and e at the end.\nCalculate the average of pairs formed by the elements at s and e and store these averages in the avg vector.\nMove the pointers inward: increment s and decrement e.\nContinue this process for time iterations, where time is half the size of the input vector, ensuring that every element is paired once.\n\n3. Finding Minimum Average: After computing the averages, sort the avg vector and return the smallest value, which will be the minimum average.\n\n\n\n# Complexity\n- Time complexity:\nO(nlogn)\n\n- Space complexity:\nO(n)\n\n# Code\n```\nclass Solution {\npublic:\n    double minimumAverage(vector<int>& nums) {\n        int time = nums.size()/2;\n        vector<double>avg;\n        sort(nums.begin(),nums.end());\n        int s = 0 ;\n        int e = nums.size()-1;\n        while(time>0 && s<=e){\n            double d = double(nums[s]+nums[e])/2;\n            avg.push_back(d);\n            s=s+1;\n            e=e-1;\n            time = time-1;\n        }\n        sort(avg.begin(),avg.end());\n        return avg[0];\n    }\n};\n```
['C++']