C++ Solution
Code\n\nclass Solution {\npublic:\n    int minimumAverageDifference(vector<int>& nums) {\n        int n = nums.size();\n        vector<long long> pref(n+1), suf
# Code\n```\nclass Solution {\npublic:\n    int minimumAverageDifference(vector<int>& nums) {\n        int n = nums.size();\n        vector<long long> pref(n+1), suff(n+1);\n        for(int i=0; i<n; i++) pref[i+1] = pref[i] + nums[i];\n        for(int i=n-1; i>=0; i--) suff[i] = suff[i+1] + nums[i];\n        int ans;\n        long long mn = INT_MAX;\n        for(int i=1; i<=n; i++) {\n            long long lt = pref[i], rt = suff[i];\n            lt /= i;\n            if(n - i) rt /= (n - i);\n            if(abs(lt - rt) < mn) {\n                mn = abs(lt - rt);\n                ans = i-1;\n            }\n        } \n        return ans;\n    }\n};\n```
['C++']