Find All Local Maximums

Meta interviews coding interview problem: Given an integer matrix, identify all local maximums. An element qualifies if it’s non-zero and no greater or equal elements exist within its square region centered at (i, j) with side length (value*2+1), excluding corners and clipped at edges. Return [row, col] pairs sorted by row then column. A concise interview question for practicing matrix scanning.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: