1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-11 02:58:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/按列翻转得到最大值等行数 [flip-columns-for-maximum-number-of-equal-rows].html
2022-03-29 12:43:11 +08:00

45 lines
1.3 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p>给定&nbsp;<code>m x n</code>&nbsp;矩阵&nbsp;<code>matrix</code>&nbsp;</p>
<p>你可以从中选出任意数量的列并翻转其上的&nbsp;<strong>每个&nbsp;</strong>单元格。(即翻转后,单元格的值从 <code>0</code> 变成 <code>1</code>,或者从 <code>1</code> 变为 <code>0</code> 。)</p>
<p>返回 <em>经过一些翻转后,行与行之间所有值都相等的最大行数</em>&nbsp;</p>
<p>&nbsp;</p>
<ol>
</ol>
<p><strong>示例 1</strong></p>
<pre>
<strong>输入:</strong>matrix = [[0,1],[1,1]]
<strong>输出:</strong>1
<strong>解释:</strong>不进行翻转,有 1 行所有值都相等。
</pre>
<p><strong>示例 2</strong></p>
<pre>
<strong>输入:</strong>matrix = [[0,1],[1,0]]
<strong>输出:</strong>2
<strong>解释:</strong>翻转第一列的值之后,这两行都由相等的值组成。
</pre>
<p><strong>示例 3</strong></p>
<pre>
<strong>输入:</strong>matrix = [[0,0,0],[0,0,1],[1,1,0]]
<strong>输出:</strong>2
<strong>解释:</strong>翻转前两列的值之后,后两行由相等的值组成。</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>m == matrix.length</code></li>
<li><code>n == matrix[i].length</code></li>
<li><code>1 &lt;= m, n &lt;= 300</code></li>
<li><code>matrix[i][j] == 0</code>&nbsp;<code>1</code></li>
</ul>