Tap here to switch tabs
Problem
Submissions

Problem: Lucky Numbers in a Matrix

easy
15 min
Explore how to find lucky numbers in a matrix by understanding the criteria of being the smallest in their row and largest in their column. This lesson helps you apply graph-based reasoning and matrix analysis to solve the problem efficiently.

Statement

Given an m×nm \times n matrix of distinct numbers, return the lucky number in the matrix.

A lucky number is an element of the matrix such that it is the smallest element in its row and largest in its column.

Constraints:

  • m=m = matrix.length

  • n=n = matrix[i].length

  • 1≤n1 \leq n, m≤50m \leq 50

  • 1≤1 \leq matrix[i][j] ≤105\leq 10^5

  • All elements in the matrix are distinct.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Lucky Numbers in a Matrix

easy
15 min
Explore how to find lucky numbers in a matrix by understanding the criteria of being the smallest in their row and largest in their column. This lesson helps you apply graph-based reasoning and matrix analysis to solve the problem efficiently.

Statement

Given an m×nm \times n matrix of distinct numbers, return the lucky number in the matrix.

A lucky number is an element of the matrix such that it is the smallest element in its row and largest in its column.

Constraints:

  • m=m = matrix.length

  • n=n = matrix[i].length

  • 1≤n1 \leq n, m≤50m \leq 50

  • 1≤1 \leq matrix[i][j] ≤105\leq 10^5

  • All elements in the matrix are distinct.