FunctionRacerProblemsRace

Runner-Up per Row

EasyNumPyPython

For each row of grid, find the second largest value in that row, counting repeats separately (so in [7, 7, 1] it is 7). Return the results as a list, one per row. Every row has at least 2 columns.

Example 1

grid [[5,9,2],[4,4,1]]
returns [5,4]

Row 0 sorted is 2, 5, 9 so the runner-up is 5. Row 1 sorted is 1, 4, 4 so it is 4.

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