Running Sum of 1d Array

Given an array nums, the task is to compute the running sum of the array where runningSum[i] is the sum of elements from nums[0] to nums[i]. Return the resulting running sum array.

Constraints

  • 1 <= nums.length <= 1000
  • -10^6 <= nums[i] <= 10^6
Saving… · 2 lines
class Solution:
def runningSum(self, nums: List[int]) -> List[int]:
Console

Click Run to execute sample tests.