python, calculate sum(list) once, O(n); test case [0,1,0,1,0,1] explained
CAUTION:\nIf you didn\'t pass test case [0,1,0,1,0,1], you might want to read the following sentence from the description again. :-P\n\nBoth averages should be 
**CAUTION:**\nIf you didn\'t pass test case `[0,1,0,1,0,1]`, you might want to read the following sentence from the description again. :-P\n```\nBoth averages should be rounded down to the nearest integer.\n```\nhttps://leetcode.com/submissions/detail/854862152/\n```\nRuntime: 1684 ms, faster than 72.91% of Python3 online submissions for Minimum Average Difference.\nMemory Usage: 24.8 MB, less than 95.93% of Python3 online submissions for Minimum Average Difference.\n```\n```\nclass Solution:\n    def minimumAverageDifference(self, nums: List[int]) -> int:\n        l = len(nums)\n        if l==1: return 0\n        \n        s1, s2 = nums[0], sum(nums[1:])\n        i_smallest, abs_smallest = 0, abs(s1//1 - s2//(l-1))\n        for i in range(1,l):\n            n = nums[i]\n            l1, l2 = i+1, l-i-1\n            s1 += n; s2 -= n\n            if i!=l-1:\n                abs_curr = abs(s1//l1 - s2//l2)\n            else:\n                abs_curr = s1//l1\n            if abs_curr<abs_smallest:\n                abs_smallest = abs_curr\n                i_smallest = i\n                \n        return i_smallest  \n```\n\n
['Python']