Tap here to switch tabs
Problem
Submissions

Problem: Running Sum of 1d Array

med
30 min
Try to solve the Running Sum of 1d Array problem.

Statement

Given an integer array nums, return an array ans of the same length where each element ans[i] equals the sum of nums[0] through nums[i] (inclusive). This is the running prefix sum of nums.

Constraints:

  • 1≤1 \leq nums.length ≤1000\leq 1000

  • −106≤-10^6 \leq nums[i] ≤106\leq 10^6

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Running Sum of 1d Array

med
30 min
Try to solve the Running Sum of 1d Array problem.

Statement

Given an integer array nums, return an array ans of the same length where each element ans[i] equals the sum of nums[0] through nums[i] (inclusive). This is the running prefix sum of nums.

Constraints:

  • 1≤1 \leq nums.length ≤1000\leq 1000

  • −106≤-10^6 \leq nums[i] ≤106\leq 10^6