Regional Maximum Finder
Problem Overview
- Find all regional maxima in a 2D integer array and return their positions.
- Input: int[][] array; Output: int[][] of [i,j] indices for maxima; only cells with value != 0.
- For cell (i,j) with value v: region is rows i−v..i+v and cols j−v..j+v, exclude four corners; ignore out-of-bounds; regional maximum = largest value in its region.
- Domain: matrix/image neighborhood analysis; asked in Uber interviews; a coding interview problem and common interview question.
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:
