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

Core interview problems are free with a full runner and lessons; Pro opens the complete library.

More Matrices problems