0533. Lonely Pixel II

https://leetcode.com/problems/lonely-pixel-ii

Description

Given an m x n picture consisting of black 'B' and white 'W' pixels and an integer target, return the number of black lonely pixels.

A black lonely pixel is a character 'B' that located at a specific position (r, c) where:

  • Row r and column c both contain exactly target black pixels.

  • For all rows that have a black pixel at column c, they should be exactly the same as row r.

Example 1:

Example 2:

Constraints:

  • m == picture.length

  • n == picture[i].length

  • 1 <= m, n <= 200

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

  • 1 <= target <= min(m, n)

ac

Last updated

Was this helpful?