Tap here to switch tabs
Problem
Submissions

Problem: Minimum Flips to Make Binary Grid Palindromic I

Minimum Flips to Make Binary Grid Palindromic I gives a binary matrix; return the fewest cell flips needed to make every row palindromic or every column palindromic.

Statement

You are given an m ×\times 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

Minimum Flips to Make Binary Grid Palindromic I gives a binary matrix; return the fewest cell flips needed to make every row palindromic or every column palindromic.

Statement

You are given an m ×\times 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