Tap here to switch tabs
Problem
Submissions

Problem: Special Positions in a Binary Matrix

Special Positions in a Binary Matrix asks you to count the ones whose entire row and column contain no other ones, then return that total.

Statement

Given an m×nm \times n binary matrix mat, return the total number of special positions in mat.

A position (i, j) is considered special if mat[i][j] is equal to 11 and every other element in row i and column j is equal to 00, assuming rows and columns are 00 indexed.

Constraints:

  • m == mat.length

  • n == mat[i].length

  • 1≤1 \le m, n ≤100\le 100

  • mat[i][j] is either 00 or 11.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Special Positions in a Binary Matrix

Special Positions in a Binary Matrix asks you to count the ones whose entire row and column contain no other ones, then return that total.

Statement

Given an m×nm \times n binary matrix mat, return the total number of special positions in mat.

A position (i, j) is considered special if mat[i][j] is equal to 11 and every other element in row i and column j is equal to 00, assuming rows and columns are 00 indexed.

Constraints:

  • m == mat.length

  • n == mat[i].length

  • 1≤1 \le m, n ≤100\le 100

  • mat[i][j] is either 00 or 11.