Python 3  ||  8 lines,  w/ explanation and example  ||  T/S: 95% / 80%
\nclass Solution:\n    def minimumAverageDifference(self, nums: list[int]) -> int:\n\n                                                        # Example: nums = 
```\nclass Solution:\n    def minimumAverageDifference(self, nums: list[int]) -> int:\n\n                                                        # Example: nums = [2, 5, 4, 3, 1, 9, 5, 3]\n        n = len(nums)                                   # \n        pref = list(accumulate(nums))                   #           pref = [2, 7,11,14,15,24,29,32]\n                                                        #              i:   0  1  2  3  4  5  6  7\n                                                        # \n        ans = (pref[-1]//n, n-1)                        #           ans = (32//8,8-1) = (4,7)\n  \n        for i in range(n-1):                            #      i        1st ave       2nd ave    abs diff    ans\n            diff = abs(pref[i]//(i+1) -                 #   \u2013\u2013\u2013\u2013\u2013\u2013\u2013     \u2013\u2013\u2013\u2013\u2013\u2013\u2013\u2013      \u2013\u2013\u2013\u2013\u2013\u2013\u2013\u2013   \u2013\u2013\u2013\u2013\u2013\u2013\u2013    \u2013\u2013\u2013\u2013\u2013\u2013\n                      (pref[-1] - pref[i])//(n-i-1))    #                                                   (4, 7)\n\n                                                        #      0        2//1 = 2      29//7 = 4      2      (2, 0)\n            ans  = min(ans, (diff,i))                   #      1        7//2 = 3      25//6 = 4      1      (1, 1)\n                                                        #      2       11//3 = 3      21//5 = 4      1      (1, 1)\n        return ans[1]                                   #      3       14//4 = 3      18//4 = 4      1      (1, 1)\n                                                        #      4       15//5 = 3      17//3 = 5      2      (1, 1)\n                                                        #      5       24//6 = 4       8//2 = 4      0      (0, 5)\n                                                        #      6       29//7 = 4       3//1 = 3      1      (0, 5)\n                                                        #                                                       |\n                                                        #                                             return ans[1]\n```\n[https://leetcode.com/submissions/detail/854132107/](https://leetcode.com/submissions/detail/854132107/)\n\nI could be wrong, but I think that time is *O*(*N*) and space is *O*(*N*), in which *N* ~ `len(nums)`.
['Python']