LeetCode 1480 Running Sum of 1d Array - Problem Statement

The problem

Given an array nums, return the running sum where result[i] equals the sum of nums[0] through nums[i].

With nums = [1, 2, 3, 4], the answer is [1, 3, 6, 10]. The first element stays 1. The second is 1 + 2 = 3. The third is 1 + 2 + 3 = 6. The fourth is 1 + 2 + 3 + 4 = 10.

This is the foundation of prefix sums. How can you compute this efficiently in a single pass?

Constraints: 1n10001 \le n \le 1000, values from 106-10^6 to 10610^6.