FunctionRacerProblemsRace

Subtract Row Minimum

MediumNumPyPython

Return a new 2-D array in which every cell of grid has had the smallest value of its own row subtracted from it. After this, the smallest value in each row is 0. Hint: keepdims=True makes the minimums broadcast across each row.

Example 1

grid [[5,7,6],[10,10,12]]
returns [[0,2,1],[0,0,2]]

Row 0 has minimum 5 and row 1 has minimum 10.

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