Company: Visa_17sep
Difficulty: medium
Number of 2x2 Submatrices with Black Cells Problem Description For a grid of black and white cells with rows rows and cols columns, you're given an array black that contains the [row, column] coordinates of all the black cells in the grid. Your task is to compute how many 2 x 2 submatrices of the grid contain exactly blackCount black cells, for each 0 . As a result, you will return an array of 5 integers, where the i th element is the number of 2 x 2 submatrices with exactly i black cells. It is guaranteed that black cell coordinates are pairwise unique, so the same cell is not colored twice. Examples Example 1: Input: rows = 3, cols = 3, black = [[0, 0], [0, 1], [1, 0]] Output: [1, 2, 0, 1, 0] Explanation: Let's visualize the 3x3 grid with the given black cells: B B W B W W W W W Where 'B' denotes a black cell and 'W' denotes a white cell. We need to count the number of 2x2 submatrices with 0, 1, 2, 3, or 4 black cells. The possible upper-left corners for a 2x2 submatrix in a 3x3 grid