Class Solution
java.lang.Object
g1801_1900.s1886_determine_whether_matrix_can_be_obtained_by_rotation.Solution
1886 - Determine Whether Matrix Can Be Obtained By Rotation.<p>Easy</p>
<p>Given two <code>n x n</code> binary matrices <code>mat</code> and <code>target</code>, return <code>true</code> <em>if it is possible to make</em> <code>mat</code> <em>equal to</em> <code>target</code> <em>by <strong>rotating</strong></em> <code>mat</code> <em>in <strong>90-degree increments</strong> , or</em> <code>false</code> <em>otherwise.</em></p>
<p><strong>Example 1:</strong></p>
<p><img src="https://assets.leetcode.com/uploads/2021/05/20/grid3.png" alt="" /></p>
<p><strong>Input:</strong> mat = [[0,1],[1,0]], target = [[1,0],[0,1]]</p>
<p><strong>Output:</strong> true</p>
<p><strong>Explanation:</strong> We can rotate mat 90 degrees clockwise to make mat equal target.</p>
<p><strong>Example 2:</strong></p>
<p><img src="https://assets.leetcode.com/uploads/2021/05/20/grid4.png" alt="" /></p>
<p><strong>Input:</strong> mat = [[0,1],[1,1]], target = [[1,0],[0,1]]</p>
<p><strong>Output:</strong> false</p>
<p><strong>Explanation:</strong> It is impossible to make mat equal to target by rotating mat.</p>
<p><strong>Example 3:</strong></p>
<p><img src="https://assets.leetcode.com/uploads/2021/05/26/grid4.png" alt="" /></p>
<p><strong>Input:</strong> mat = [[0,0,0],[0,1,0],[1,1,1]], target = [[1,1,1],[0,1,0],[0,0,0]]</p>
<p><strong>Output:</strong> true</p>
<p><strong>Explanation:</strong> We can rotate mat 90 degrees clockwise two times to make mat equal target.</p>
<p><strong>Constraints:</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> and <code>target[i][j]</code> are either <code>0</code> or <code>1</code>.</li>
</ul>
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
findRotation
public boolean findRotation(int[][] mat, int[][] target)
-