Tap here to switch tabs
Problem
Submissions

Problem: Minimum Flips to Make Binary Grid Palindromic I

med
30 min
Try to solve the Minimum Flips to Make Binary Grid Palindromic I problem.

Statement

You are given an m $ imes$ n binary matrix grid.

A row or column is considered palindromic if its elements read the same forwards and backwards.

In one operation, you can flip any cell in grid from 00 to 11 or from 11 to 00.

Return the minimum number of flips required to make either all rows palindromic or all columns palindromic.

Constraints:

  • m ==== grid.length

  • n ==== grid[i].length

  • 1≤1 \leq m * n ≤2⋅105\leq 2 \cdot 10^5

  • 0≤0 \leq grid[i][j] ≤1\leq 1

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Minimum Flips to Make Binary Grid Palindromic I

med
30 min
Try to solve the Minimum Flips to Make Binary Grid Palindromic I problem.

Statement

You are given an m $ imes$ n binary matrix grid.

A row or column is considered palindromic if its elements read the same forwards and backwards.

In one operation, you can flip any cell in grid from 00 to 11 or from 11 to 00.

Return the minimum number of flips required to make either all rows palindromic or all columns palindromic.

Constraints:

  • m ==== grid.length

  • n ==== grid[i].length

  • 1≤1 \leq m * n ≤2⋅105\leq 2 \cdot 10^5

  • 0≤0 \leq grid[i][j] ≤1\leq 1