A sales dashboard draws a cumulative chart: each point shows the total sales from the first day up to and including that day.
Write runningTotals(sales) that returns an array of the same length where item i is sales[0] + sales[1] + ... + sales[i].
Input: sales = [3,1,4,1,5] Output: [3,4,8,9,14]
Each number is the previous total plus that day's sales.
Input: sales = [] Output: []
No days, no totals.
0 <= sales.length <= 2 * 10^5-10^4 <= sales[i] <= 10^4Run tries your code on the examples. Submit runs every test, including hidden edge cases and big inputs that check your code is fast enough, and solves the problem when they all pass.
Ctrl + Enter runs, Ctrl + Shift + Enter submits (⌘ on a Mac).
I'm here to help with #38 Running Total of Sales. I give hints, never the solution, so you get to solve it yourself. Ask for a hint, select code to ask about it, or press Ask Tuto why on a failing test.
Your first 3 answers need no account. for free to keep asking.