|
| 1 | +<h2><a href="https://leetcode.com/problems/flip-columns-for-maximum-number-of-equal-rows/">1072. Flip Columns For Maximum Number of Equal Rows</a></h2><h3>Medium</h3><hr><div><p>You are given an <code>m x n</code> binary matrix <code>matrix</code>.</p> |
| 2 | + |
| 3 | +<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> |
| 4 | + |
| 5 | +<p>Return <em>the maximum number of rows that have all values equal after some number of flips</em>.</p> |
| 6 | + |
| 7 | +<p> </p> |
| 8 | +<p><strong class="example">Example 1:</strong></p> |
| 9 | + |
| 10 | +<pre><strong>Input:</strong> matrix = [[0,1],[1,1]] |
| 11 | +<strong>Output:</strong> 1 |
| 12 | +<strong>Explanation:</strong> After flipping no values, 1 row has all values equal. |
| 13 | +</pre> |
| 14 | + |
| 15 | +<p><strong class="example">Example 2:</strong></p> |
| 16 | + |
| 17 | +<pre><strong>Input:</strong> matrix = [[0,1],[1,0]] |
| 18 | +<strong>Output:</strong> 2 |
| 19 | +<strong>Explanation:</strong> After flipping values in the first column, both rows have equal values. |
| 20 | +</pre> |
| 21 | + |
| 22 | +<p><strong class="example">Example 3:</strong></p> |
| 23 | + |
| 24 | +<pre><strong>Input:</strong> matrix = [[0,0,0],[0,0,1],[1,1,0]] |
| 25 | +<strong>Output:</strong> 2 |
| 26 | +<strong>Explanation:</strong> After flipping values in the first two columns, the last two rows have equal values. |
| 27 | +</pre> |
| 28 | + |
| 29 | +<p> </p> |
| 30 | +<p><strong>Constraints:</strong></p> |
| 31 | + |
| 32 | +<ul> |
| 33 | + <li><code>m == matrix.length</code></li> |
| 34 | + <li><code>n == matrix[i].length</code></li> |
| 35 | + <li><code>1 <= m, n <= 300</code></li> |
| 36 | + <li><code>matrix[i][j]</code> is either <code>0</code> or <code>1</code>.</li> |
| 37 | +</ul> |
| 38 | +</div> |
0 commit comments