grid of m rows and n columns: 1 means the bulb is on, 0 means it is off. Each column has its own switch that toggles every bulb in that column.
You may press any switches, each as many times as you like. A row is uniform when its bulbs are all on or all off.
Return the largest number of uniform rows you can get.grid=[[1, 0, 1], [0, 1, 0], [1, 1, 1]] → 2
Flip the middle column: the rows become [1, 1, 1], [0, 0, 0] and [1, 0, 1], so two are uniform.
grid=[[0, 1], [0, 0]] → 1
The rows are neither equal nor opposite, so only one of them can be made uniform.
grid=[[1, 0, 0, 1], [0, 1, 1, 0], [1, 0, 0, 1]] → 3
Flip columns 1 and 2: all three rows become uniform.
grid[i][j] is 0 or 1grid=[[1, 0, 1], [0, 1, 0], [1, 1, 1]]
2
Run checks the first 3 tests in your browser. Submit checks all 90 tests on the server, hidden ones included.