Class Solution
java.lang.Object
g1001_1100.s1072_flip_columns_for_maximum_number_of_equal_rows.Solution
1072 - Flip Columns For Maximum Number of Equal Rows.<p>Medium</p>
<p>You are given an <code>m x n</code> binary matrix <code>matrix</code>.</p>
<p>You can choose any number of columns in the matrix and flip every cell in that column (i.e., Change the value of the cell from <code>0</code> to <code>1</code> or vice versa).</p>
<p>Return <em>the maximum number of rows that have all values equal after some number of flips</em>.</p>
<p><strong>Example 1:</strong></p>
<p><strong>Input:</strong> matrix = [[0,1],[1,1]]</p>
<p><strong>Output:</strong> 1</p>
<p><strong>Explanation:</strong> After flipping no values, 1 row has all values equal.</p>
<p><strong>Example 2:</strong></p>
<p><strong>Input:</strong> matrix = [[0,1],[1,0]]</p>
<p><strong>Output:</strong> 2</p>
<p><strong>Explanation:</strong> After flipping values in the first column, both rows have equal values.</p>
<p><strong>Example 3:</strong></p>
<p><strong>Input:</strong> matrix = [[0,0,0],[0,0,1],[1,1,0]]</p>
<p><strong>Output:</strong> 2</p>
<p><strong>Explanation:</strong> After flipping values in the first two columns, the last two rows have equal values.</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>m == matrix.length</code></li>
<li><code>n == matrix[i].length</code></li>
<li><code>1 <= m, n <= 300</code></li>
<li><code>matrix[i][j]</code> is either <code>0</code> or <code>1</code>.</li>
</ul>
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
maxEqualRowsAfterFlips
public int maxEqualRowsAfterFlips(int[][] matrix)
-