Simple Prefix Sum || C++ Solution
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int minimumAverageDifference(vector<int>& nums) {\n        long long totalSum = 0;\n        int n = nums.size();\n        if(n==1)return 0;\n        for(auto x:nums){\n            totalSum += x; \n        }\n        int ind = 0,mini=INT_MAX;\n        \n        long long stSum = 0;\n        for(int i=1;i<=n;i++){\n            stSum += nums[i-1];\n            long long enSum = totalSum-stSum;\n            int avg = 0;\n            if(n-i==0){\n                avg = stSum/i;\n            }else\n            avg = abs((stSum/i) - (enSum/(n-i)));\n            if(avg<mini){\n                mini = avg;\n                ind = i-1;\n            }\n        }\n        return ind;\n    }\n};\n```
['Array', 'Prefix Sum', 'C++']