Medium · Matrices

Remove All Ones With Row and Column Flips

Given an m × n binary matrix grid, where one operation flips every bit in a chosen row or a chosen column, return true if some sequence of operations can make every cell 0, otherwise false.

Examples

Example 1

[[0,1,0],[1,0,1],[0,1,0]] → true

Output: true (clearable)

Example 2

[[1,1,0],[0,0,0],[0,0,0]] → false

Output: false (impossible)

Rebuild it in the studio

Open every published interview problem, solution, scene, and memory room free, with no account.

More Matrices problems