Find Number in Matrix

Problem Overview

  • Find a matrix element that is the largest in its row and the smallest in its column; if none exists, output -1.
  • Input: N and M, then an N×M matrix of non-negative integers; 1 ≤ N, M ≤ 1000. Output: the qualifying number or -1.
  • Context: Matrix/data table analysis relevant to grid-based data processing.
  • Company/SEO: From Cisco interviews; a common coding interview interview question problem.

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: