Special Positions in a Binary Matrix (LeetCode 1582)

📅 2026-11-05T17:21:18.168Z
👁️ 65 katselukertaa
🔓 Julkinen


# Special Positions in a Binary Matrix (LeetCode 1582)

## Goal
Count 1-cells that are the only 1 in their row and column.

## Approach
Precompute row and column sums, then count cells with mat[i][j]==1 and both sums equal 1.

## Tip
Two-pass counting is a common matrix pattern.

Prep notes shared by the Linkjob AI team. Practice explaining solutions out loud with [AI coding interview assistant](https://www.linkjob.ai/coding-interview-copilot/).