With Explanation Comments:  Time: 214 ms (42.49%), Space: 78.3 MB (94.22%)
Like it? ->Upvote please! \u30C4\n\nTC: O(n)   //iterate the array\nSC: O(1)\n\n\n\'\'\'\nclass Solution {\npublic:\n    \n    int minimumAverageDifference(vect
**Like it? ->Upvote please!** \u30C4\n\nTC: O(n)   //iterate the array\nSC: O(1)\n\n\n\'\'\'\nclass Solution {\npublic:\n    \n    int minimumAverageDifference(vector<int>& nums) {\n        \n        //initialize two sum variables-> one from the left or start & one from the right or end\n        long long sumLeft=0, sumRight=0, minAvg=INT_MAX, index=0;\n        \n        //loop to get the sumRight value\n        for(int num:nums)\n            sumRight+=num;\n    //btw, you can use {sumRight=accumulate(nums.begin(), nums.end(), 0LL)} instead\n        \n    //loop over the whole array elements\n        for(int i=0;i<nums.size();i++){\n            \n            //add the current value to the left sum-> (i+1) elements\n            sumLeft+=nums[i];\n            //subtract the current value from the right sum-> (n-i-1) elements\n            sumRight-=nums[i];\n            \n            //average for the left sum-> sum value / the number of left elements\n            int avgLeft=sumLeft/(i+1);\n            //average for the right sum-> sum value / the number of right elements & if you\'re in the last position-> avg will be 0\n            int avgRight= (i==nums.size()-1) ? 0 : sumRight/(nums.size()-i-1);\n            \n            \n            //check if the absolute difference between the two averages is smaller than the lowest possible avg\n            if(abs(avgLeft-avgRight) < minAvg){\n                //replace the avg value with the lower one\n                minAvg=abs(avgLeft-avgRight);\n                //also, save the current index of the lower one\n                index=i;\n            }\n            \n        }\n        \n    //return the lowest index value\n        return index;\n    }\n};\n\'\'\'\n\n**Like it? ->Upvote please!** \u30C4\n**If still not understood, feel free to comment. I will help you out**\n**Happy Coding :)**
['Array', 'C', 'Prefix Sum', 'C++']