Description
You are given an m x n binary matrix. You can choose any number of columns and flip every cell in that column. Return the maximum number of rows that have all values equal after some number of flips.
Examples
Input:
matrix = [[0,1],[1,1]]Output:
1Explanation:
One row can be all equal.
Input:
matrix = [[1]]Output:
1Explanation:
A 1x1 matrix with a single cell already has all values equal (just the one cell), so 1 row can be made uniform without any flips.
Input:
matrix = [[0,0,0],[1,1,1],[0,1,0]]Output:
2Explanation:
After the best choice of column flips, 2 rows can be made equal, so the answer is 2.
Constraints
- •
m == matrix.length - •
n == matrix[i].length - •
1 ≤ m, n ≤ 300