Search⌘ K
AI Features

Solution: Lucky Numbers in a Matrix

Solution: Lucky Numbers in a Matrix gives you a matrix of distinct numbers and asks you to return its lucky number: a value that is smallest in its row and largest in its column.

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= ...