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

Read every interview problem free. Ten rooms need no account. A token opens a problem in full — Pro never counts.

More Matrices problems