Tap here to switch tabs
Problem
Submissions

Problem: Count Submatrices With Equal Frequency of X and Y

Try to solve the Count Submatrices With Equal Frequency of X and Y problem.

Statement

Given a 22D matrix of characters grid containing the characters 'X', 'Y', and '.'.

Return the number of submatrices that include the top left cell grid[0][0], contain at least 11 occurrence of 'X', and have an equal frequency of 'X' and 'Y'.

Constraints:

  • 1≤1 \leq grid.length, grid[i].length ≤1000\leq 1000

  • grid[i][j] is either 'X', 'Y', or '.'.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Count Submatrices With Equal Frequency of X and Y

Try to solve the Count Submatrices With Equal Frequency of X and Y problem.

Statement

Given a 22D matrix of characters grid containing the characters 'X', 'Y', and '.'.

Return the number of submatrices that include the top left cell grid[0][0], contain at least 11 occurrence of 'X', and have an equal frequency of 'X' and 'Y'.

Constraints:

  • 1≤1 \leq grid.length, grid[i].length ≤1000\leq 1000

  • grid[i][j] is either 'X', 'Y', or '.'.