💡Python O(n) simple solution
Intuition\nAccording to constraint 1 <= nums.length <= 10 ** 5 we cannot re-calculate avg values for sub-arrays every time.\n\n# Approach\n\n1. Right handside a
# Intuition\nAccording to constraint `1 <= nums.length <= 10 ** 5` we cannot re-calculate avg values for sub-arrays every time.\n\n# Approach\n\n1. Right handside area\n   1. Calculate a sum for all elements in `nums` for the further tracking\n   2. Remember `nums` len\n2. Left handside area\n   1. Set placeholders because we begin with the first index `0` we have nothing on the left area so it is `0` as well as the count of elements is `0`\n3. On each step of iteration we need to transfer numbers from the right area to the left area. We can do it by substituion the current number from the right area sum and adding it to the left area. Also we update the numbers of integers accordingly.\n\n# Complexity\n- Time complexity: O(n)\n- Space complexity: O(1)\n\n# Code\n```\nclass Solution:\n    def minimumAverageDifference(self, nums: List[int]) -> int:\n\n        sum_right = sum(nums)\n        len_right = len(nums)\n        sum_left = 0\n        len_left = 0\n\n        min_avg = inf\n        index = 0\n\n        for i in range(len(nums)):\n            \n            sum_left += nums[i]\n            len_left += 1\n\n            sum_right -= nums[i]\n            len_right -= 1\n\n            #in case of only zeroes left on right\n            if sum_right == 0:\n                v = sum_left // len_left\n            else:\n                v = abs(\n                    sum_left // len_left - sum_right // len_right\n                )\n\n            if v < min_avg:\n                min_avg = v\n                index = i\n\n        return index\n\n```
['Prefix Sum', 'Python3']