Running Total per Column
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
1 <= rows, columns <= 10
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More NumPy problems
- Scale to Zero OneEasy
- Second LargestEasy
- Smallest PositiveEasy
- Softmax WeightsEasy
- Sort Each RowEasy
- Strong RowsEasy
- Total Over LimitEasy
- Trend SlopeEasy