about | help | code help+videos | done | prefs |
If someone gives you a list of numbers, you can keep track of the "running total" by adding the numbers in the order that they are given you. For example, if someone gives you the numbers 1, 8, 7, 2, in that order, then your running totals would be: 1, 9, 16, 18 (because 1 + 8 is 9, 1 + 8 + 7 is 16, and 1 + 8 + 7 + 2 is 18). Given an array of integers, return a new array of integers representing the corresponding running totals. If the given array is empty, return an empty array. runningTotal([1, 8, 7, 2]) → [1, 9, 16, 18] runningTotal([2, 4, 6]) → [2, 6, 12] runningTotal([-1, 0, 0, 7]) → [-1, -1, -1, 6] ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 200
Copyright Nick Parlante 2017 - privacy