Problems / Running Sum of an Array
Easy

Running Sum of an Array

Easy 259 submissions 10 coins +50 XP
Array Prefix Sum
Problem Description
You are given an integer array `nums`. Build a new array where position `i` holds the sum of `nums[0]` through `nums[i]` (inclusive), and return it. **Example 1:** ``` Input: nums = [1, 2, 3, 4] Output: [1, 3, 6, 10] ``` **Example 2:** ``` Input: nums = [3, 1, 2, 10, 1] Output: [3, 4, 6, 16, 17] ``` **Example 3:** ``` Input: nums = [5] Output: [5] ```
Constraints
- `1 <= nums.length <= 1000` - `-10^6 <= nums[i] <= 10^6`

Need help?

Connect with expert programmers for real-time collaborative coding, video meetings, and whiteboard sessions via CodeConnect.

Video Call Whiteboard Live Coding Screen Share