Skip to content
RED SAGSkills
easy15 ptsarraysmath

Cumulative Totals

Daily sign-ups are stored in daily. Return an array of the same length where position i holds the total sign-ups from day 0 through day i inclusive.

Example 1

Input: daily = [4, 0, 3, 5]
Output: [4, 4, 7, 12]

Example 2

Input: daily = []
Output: []

Constraints

  • 0 <= daily.length <= 10^5
  • -10^4 <= daily[i] <= 10^4
Hint 1

Carry a running sum as you walk the array.

Good practice for: Data Scientist, Data Engineer, Machine Learning Engineer, AI Engineer (LLM & Generative AI), Backend Developer, Full Stack Developer, Frontend Developer

Run checks your code on 2 sample tests. Submit runs all 6 tests, including hidden ones, and earns points. Use console.log to debug. Python's first run can take a few seconds while it starts.