Python | Simple | Beats 100% | O(n) Time & Space | 😊
Complexity
Time complexity: O(n)

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

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

# Code
```python []
class Solution(object):
    def minimumAverageDifference(self, nums):
        
        tot = sum(nums)
        n = len(nums)
        min_i = None
        min_abs_diff= float('inf')
        curr_sum=0
        for i in range(n):
            curr_sum+=nums[i]
            t = abs((curr_sum//(i+1))-((tot-curr_sum)//(n-i-1) if tot-curr_sum else 0 ))
            if t <min_abs_diff:
                min_i = i
                min_abs_diff = t
        return min_i
```
['Python']