You may flip any whole row or whole column of the binary grid, replacing each 0 with 1 and each 1 with 0. Interpret every row as a binary integer, with its leftmost entry as the most significant bit, and add these integers to obtain the score. Return the largest score achievable after any number of flips, including none.
Example 1:
Input: grid = [[0,1],[1,0]]
Output: 6Explanation: Flip the first row to obtain [[1,0],[1,0]], then flip the second column to obtain [[1,1],[1,1]]. Both rows represent 3, giving the maximum score 6.
Example 2:
Input: grid = [[1,0],[1,1]]
Output: 5Explanation: The rows already represent 2 and 3. A score of 6 would require both rows to be 11, but row and column flips cannot make these two rows identical. The maximum is 5.
Example 3:
Input: grid = [[0]]
Output: 1Explanation: Flip the only row or column so its entry becomes 1. The resulting score is 1.
Constraints:
1 <= grid.length <= 20- Every row has the same length, between
1and20. - Every entry is either
0or1.