1480. 一维数组的动态和
为保证权益,题目请参考 1480. 一维数组的动态和(From LeetCode).
解决方案1
Python
python
# 1480. 一维数组的动态和
# https://leetcode-cn.com/problems/running-sum-of-1d-array/
from typing import List
from functools import reduce
class Solution:
def runningSum(self, nums: List[int]) -> List[int]:
ans = []
t = 0
for num in nums:
t += num
ans.append(t)
return ans
if __name__ == "__main__":
solution = Solution()
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19