假设我们有一个长度为n的数组arr,前缀和数组prefixSum的定义如下:

prefixSum[0] = arr[0] 
prefixSum[1] = arr[0] + arr[1] 
prefixSum[2] = arr[0] + arr[1] + arr[2] 
... 
prefixSum[i] = arr[0] + arr[1] + ... + arr[i]