C++ super easy solution using prefix sum method
\nclass Solution {\npublic:\n    int minimumAverageDifference(vector<int>& nums) {\n        long long sum = 0;\n        for (int i:nums){\n            sum+=i;\n
```\nclass Solution {\npublic:\n    int minimumAverageDifference(vector<int>& nums) {\n        long long sum = 0;\n        for (int i:nums){\n            sum+=i;\n        }\n        long long temp = 0;\n        int mad = INT_MAX;\n        int ans = 0;\n        int n = nums.size();\n        for (int i=0;i<n;i++){\n            temp+=nums[i];\n            int a1 = temp/(i+1);\n            int a2 = (n-i-1)!=0 ? (sum-temp)/(n-i-1) : 0;\n            int curr = abs(a1-a2);\n            if (curr<mad){\n                ans = i;\n                mad = curr;\n            }\n        }\n        return ans;\n    }\n};\n```\n\n**Please upvote if you like it. Thanks :)**
['C', 'Prefix Sum']