✅C++ |  ✅Prefix & Suffix Sum |  ✅Easy & Efficient
\nclass Solution {\npublic:\n    int minimumAverageDifference(vector<int>& nums) \n    {\n        int n=nums.size();\n        \n        long long right_sum = 0;
```\nclass Solution {\npublic:\n    int minimumAverageDifference(vector<int>& nums) \n    {\n        int n=nums.size();\n        \n        long long right_sum = 0;\n        for(auto it:nums) right_sum += it;\n        \n        int mini = INT_MAX;\n        int idx = 0;\n        \n        long long left_sum = 0;\n        \n        for(int i=0; i<n; i++)\n        {\n            left_sum += nums[i];\n            right_sum -= nums[i];\n            \n            long long first = (left_sum/(i+1));\n    \n            long long last = i<n-1 ? (right_sum/(n-i-1)) : 0;\n            \n            int diff = abs(first - last);\n            \n            if(diff < mini)\n            {\n                mini = diff;\n                idx = i;\n            }\n        }\n        \n        return idx;\n    }\n};\n```
['Array', 'C', 'Prefix Sum', 'C++']