C++ || Use suffix sum || Easy to understand
\nclass Solution {\npublic:\n    int minimumAverageDifference(vector<int>& nums) {\n        long long int left = 0;\n        long long int right = 0;\n        f
```\nclass Solution {\npublic:\n    int minimumAverageDifference(vector<int>& nums) {\n        long long int left = 0;\n        long long int right = 0;\n        for(auto i: nums)\n            right += i;\n        \n        int n = nums.size();\n        int mn = INT_MAX;\n        int idx = 0;\n        for(int i=0; i<nums.size(); i++){\n            left += nums[i];\n            right -= nums[i];\n            // cout<< left << "\\t" << right << "\\t" <<left/(i+1) << "\\t" << right/(n-1-i) << endl;\n            \n            int diff = 0;\n            if(i==n-1)\n                diff = left/(i+1);\n            else\n                diff = abs(left/(i+1) - right/(n-1-i));\n             \n            if(diff < mn){\n                mn = diff;\n                idx = i;\n            }\n        }\n        \n        return idx;\n    }\n};\n```
['C']