Tap here to switch tabs
Problem
Submissions

Problem: Lonely Pixel II

Try to solve the Lonely Pixel II problem.

Statement

Given an m by n grid picture of characters where each element is either 'W' representing white or 'B' representing black, and an integer target, return the total number of black pixels picture[r][c] that satisfy the following conditions:

  1. Row r has exactly target black pixels.

  2. Column c has exactly target black pixels.

  3. All rows containing a black pixel at column c are completely identical to row r.

Constraints:

  • m == picture.length

  • n == picture[i].length

  • 1≤1 \leq m, n ≤200\leq 200

  • picture[i][j] is 'W' or 'B'.

  • 1≤1 \leq target ≤min⁡(\leq \min( m, n ))

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Lonely Pixel II

Try to solve the Lonely Pixel II problem.

Statement

Given an m by n grid picture of characters where each element is either 'W' representing white or 'B' representing black, and an integer target, return the total number of black pixels picture[r][c] that satisfy the following conditions:

  1. Row r has exactly target black pixels.

  2. Column c has exactly target black pixels.

  3. All rows containing a black pixel at column c are completely identical to row r.

Constraints:

  • m == picture.length

  • n == picture[i].length

  • 1≤1 \leq m, n ≤200\leq 200

  • picture[i][j] is 'W' or 'B'.

  • 1≤1 \leq target ≤min⁡(\leq \min( m, n ))