less than 1 minute read

Given a two-dimensional integer matrix, return the total number of integers whose value is the largest in its row and in its column.

Constraints

  • n, m ≤ 250 where n and m are the number of rows and columns in matrix

https://binarysearch.com/problems/Big-Numbers

Examples

Example 1

Input

  • matrix =
[[1,3,2],
 [6,6,5],
 [1,5,7]]

Output

  • answer = 3

Explanation

The 3 big numbers are 6, 6, and 7.

Example 2

Input

  • matrix =
[[1,2,3,2],
 [3,2,3,2],
 [1,2,2,3],
 [1,1,1,1]]

Output

  • answer = 4

Solution

Categories:

Updated:

Leave a comment