Using prefix sums (where `sums[i]`

is the sum of the first `i`

numbers) to compute subarray sums.

```
def findMaxAverage(self, nums, k):
sums = [0] + list(itertools.accumulate(nums))
return max(map(operator.sub, sums[k:], sums)) / k
```

NumPy version (requires `import numpy as np`

):

```
def findMaxAverage(self, nums, k):
sums = np.cumsum([0] + nums)
return int(max(sums[k:] - sums[:-k])) / k
```