FunctionRacerProblemsRace

Higher Than Its Neighbors

HardNumPyPython

Return the [row, column] of every cell of grid that is strictly greater than each of its neighbors: the cells above, below, left and right of it. A cell on the edge has fewer neighbors. List the cells in reading order. No loops: for and while are not allowed.

Example 1

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

5 beats 1, 1 and 1. 6 beats 1, 1 and 1. 7 beats 2 and 2.

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