IIT | Simple appraoch | C++ | O(N)& O(1) | 
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```cpp []
class Solution {
public:
    int minimumAverageDifference(vector<int>& nums) {
    int n = nums.size();
    if (n == 1) return 0;

    long long left = 0, sum = accumulate(nums.begin(), nums.end(), 0LL);
    int ans = -1, diff = INT_MAX;

    for (int i = 0; i < n; ++i) {
        left += nums[i];
        long long l = left / (i + 1);
        long long r = (i == n - 1) ? 0 : (sum - left) / (n - i - 1); // Avoid division by zero
        int new_diff = abs(l - r);

        if (new_diff < diff) {
            ans = i;
            diff = new_diff;
        }
    }
    return ans;
    }
};
```
['C++']