for english version: https://dev.to/yunshu67/intro-to-presum-pm6

source

定义子数组之和: let sum(i,j) = nums[i]+nums[i+1]...+nums[j]

前缀和 preSum

For given integer array nums of length n, we create a preSum array preSum of length n+1, with following features:

代码