FunctionRacerProblemsRace

Running Total per Column

EasyNumPyPython

grid[r][c] is the amount earned by shop c on day r. Return a 2-D array of the same shape in which each cell is the total for that shop from day 0 down to that day. Hint: np.cumsum with axis=0.

Example 1

grid [[1,10],[2,20],[3,30]]
returns [[1,10],[3,30],[6,60]]

Column 0 becomes 1, 3, 6 and column 1 becomes 10, 30, 60.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More NumPy problems