Tap here to switch tabs
Problem
Submissions

Problem: Remove All Ones With Row and Column Flips

Remove All Ones With Row and Column Flips gives a binary matrix and asks whether flipping entire rows or columns can turn every value into zero.

Statement

You are given an m×nm \times n binary matrix grid.

In one operation, you can choose any row or column and invert all of its values (changing every 00 to 11 and every 11 to 00).

Return true if it is possible to transform grid such that all its elements become 00 after applying any number of operations, or false otherwise.

Constraints:

  • m ==== grid.length

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

  • 1≤1 \leq m, n ≤300\leq 300

  • grid[i][j] is either 00 or 11.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Remove All Ones With Row and Column Flips

Remove All Ones With Row and Column Flips gives a binary matrix and asks whether flipping entire rows or columns can turn every value into zero.

Statement

You are given an m×nm \times n binary matrix grid.

In one operation, you can choose any row or column and invert all of its values (changing every 00 to 11 and every 11 to 00).

Return true if it is possible to transform grid such that all its elements become 00 after applying any number of operations, or false otherwise.

Constraints:

  • m ==== grid.length

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

  • 1≤1 \leq m, n ≤300\leq 300

  • grid[i][j] is either 00 or 11.