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)/判断矩阵经轮转后是否一致 [determine-whether-matrix-can-be-obtained-by-rotation].html
2022-03-29 12:43:11 +08:00

39 lines
1.8 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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>给你两个大小为 <code>n x n</code> 的二进制矩阵 <code>mat</code><code>target</code> 。现<strong> 以 90 度顺时针轮转 </strong>矩阵 <code>mat</code> 中的元素 <strong>若干次</strong> ,如果能够使 <code>mat</code> 与 <code>target</code> 一致,返回 <code>true</code> ;否则,返回<em> </em><code>false</code><em></em></p>
<p> </p>
<p><strong>示例 1</strong></p>
<img alt="" src="https://assets.leetcode.com/uploads/2021/05/20/grid3.png" style="width: 301px; height: 121px;" />
<pre>
<strong>输入:</strong>mat = [[0,1],[1,0]], target = [[1,0],[0,1]]
<strong>输出:</strong>true
<strong>解释:</strong>顺时针轮转 90 度一次可以使 mat 和 target 一致。
</pre>
<p><strong>示例 2</strong></p>
<img alt="" src="https://assets.leetcode.com/uploads/2021/05/20/grid4.png" style="width: 301px; height: 121px;" />
<pre>
<strong>输入:</strong>mat = [[0,1],[1,1]], target = [[1,0],[0,1]]
<strong>输出:</strong>false
<strong>解释:</strong>无法通过轮转矩阵中的元素使 equal 与 target 一致。
</pre>
<p><strong>示例 3</strong></p>
<img alt="" src="https://assets.leetcode.com/uploads/2021/05/26/grid4.png" style="width: 661px; height: 184px;" />
<pre>
<strong>输入:</strong>mat = [[0,0,0],[0,1,0],[1,1,1]], target = [[1,1,1],[0,1,0],[0,0,0]]
<strong>输出:</strong>true
<strong>解释:</strong>顺时针轮转 90 度两次可以使 mat 和 target 一致。
</pre>
<p> </p>
<p><strong>提示:</strong></p>
<ul>
<li><code>n == mat.length == target.length</code></li>
<li><code>n == mat[i].length == target[i].length</code></li>
<li><code>1 <= n <= 10</code></li>
<li><code>mat[i][j]</code><code>target[i][j]</code> 不是 <code>0</code> 就是 <code>1</code></li>
</ul>