Leetcode 1603 Solution

This article provides solution to leetcode question 1603 (running-sum-of-1d-array)

https://leetcode.com/problems/running-sum-of-1d-array

Solution

class Solution:
    def runningSum(self, nums: List[int]) -> List[int]:
        ans = []
        s = 0
        for num in nums:
            s += num
            ans.append(s)
        return ans