Given an array nums. We define a running sum of an array as runningSum[i] = sum(nums[0]…nums[i]). Return the running sum of nums. code example
Example: Given an array nums. We define a running sum of an array as runningSum[i] = sum(nums[0]…nums[i]). Return the running sum of nums.
def running_sum(nums):
sum = 0
result = []
for num in nums:
sum += num
result.append(sum)
return result