FastPrepFind Elements Largest in Row Smallest in Column
Problems/Find Elements Largest in Row Smallest in Column

Find Elements Largest in Row Smallest in Column

Cisco logoCisco● EasyFULLTIMEINTERNOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

You are given a matrix of non-negative integers. Find a number that is the largest in its row and the smallest in its column.

Equal values count: the number must be greater than or equal to every number in its row, and less than or equal to every number in its column. If several cells qualify, they always hold the same value, so return that value. If no cell qualifies, return -1.

Function

findElementLargestInRowSmallestInColumn(matrix: int[][]) → int

Examples

Example 1

matrix = [[1, 2], [3, 4]]return = 2
matrix
01012134

The number 2 at index (0,1) is the largest in its row and smallest in its column. So, the output is 2.

Constraints

  • 1 ≤ matrix.length ≤ 1000
  • 1 ≤ matrix[i].length ≤ 1000, and all rows have the same length.
  • 0 ≤ matrix[i][j] ≤ 10^9

More Cisco interview questions

  • Check if a String Is a PalindromePHONE SCREEN · Seen Nov 2026
  • Find Unique ElementsPHONE SCREEN · Seen Nov 2026
  • First Letter to Appear TwicePHONE SCREEN · Seen Nov 2026
  • Middle of a Linked ListPHONE SCREEN · Seen Nov 2026
  • Reverse a Linked ListPHONE SCREEN · Seen Nov 2026
  • Reverse a StringPHONE SCREEN · Seen Nov 2026
  • Valid ParenthesesPHONE SCREEN · Seen Nov 2026
  • K-Step Bit Flip with RetentionPHONE SCREEN · Seen Nov 2026
  • Todo Task Manager OperationsONSITE INTERVIEW · Seen Oct 2026
  • Find the Duplicate Number Without Modifying the ArrayONSITE INTERVIEW · Seen Sep 2026

Similar questions at other companies

  • Survey Table: Group Given an AnswerSusquehanna International Group (SIG) · OASusquehanna International Group (SIG) interview questions
  • Maximum Remaining Drone PowerAkuna Capital · OAAkuna Capital interview questions
  • Wind-Blown Leaves Remaining in a GridAbridge · OAAbridge interview questions
  • Query a Header-Encoded MatrixNVIDIA · OANVIDIA interview questions
  • Squared Frobenius Norm of a Reflect-and-Stretch MapWalleye Capital · OA
  • Invert or Blur an ImageOpenAI · OAOpenAI interview questions
  • Count Pieces After Othello MovesHudson River Trading · OAHudson River Trading interview questions
  • Trapped Characters in a GridAdobe · OAAdobe interview questions
  • Simulate a Deterministic Finite AutomatonPoint72 · OAPoint72 interview questions
  • Connected GroupsVisa · OAVisa interview questions
All Cisco interview questionsSee Cisco hiring insights
Saved
class Solution {
    public int findElementLargestInRowSmallestInColumn(int[][] matrix) {
      // write your code here
    }

}
Checking account…