Search
⌘K

Leetcode 2768. Number of Black Blocks

Given an m x n grid with a list of black cell coordinates, compute how many 2x2 sub-blocks contain exactly 0..4 black cells; the challenge is to handle large grids efficiently by only examining the (up to) four 2x2 blocks affected by each black cell using a hashmap to count black cells per block and deriving zero-black blocks by subtracting from the total (m-1)*(n-1).


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Your account is free and you can post anonymously if you choose.