Problem
grid is an m x n matrix of 0s and 1s. A move toggles every cell in one row or one column (0 becomes 1, 1 becomes 0). After any number of moves, read each row as a binary number and add them up. Return the highest possible score.
Example 1
grid = [[0, 0, 1, 1],
Example 2
[1, 0, 1, 0],
Example 3
- Input
- [1, 1, 0, 0]]
- Output
- 39
- Why
- 1111 + 1001 + 1111 = 15 + 9 + 15
Constraints
m == grid.lengthn == grid[i].length1 <= m, n <= 20grid[i][j] is 0 or 1.