Skip to Main Content

Running Sum of a 1D Array

Problem URL:Running Sum of a 1D Array

My Solution

Python

def runningSum(nums: List[int]) -> List[int]:
    lst = [None]*len(nums)

    for i in range(len(nums)):
        lst[i] = sum(nums[0:i+1])

    return lst

Let's Connect

Twitter GitHub LinkedIn