Prefix sum

Write codeEasy8 min

Your task

Given a list of integers nums, return its running (prefix) sum: a list of the same length where result[i] equals the sum of nums[0..i] inclusive. For example [1, 2, 3, 4] becomes [1, 3, 6, 10]. The list may be empty (return []).

Examples

running_sum(nums: list[int]) -> list[int]
Example 1
Inputrunning_sum([1, 2, 3, 4])
Output[1, 3, 6, 10]