Skip to content

Commit b706150

Browse files
Added README.md file for Strange Printer II
1 parent 661e571 commit b706150

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

1696-strange-printer-ii/README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<h2><a href="https://leetcode.com/problems/strange-printer-ii">Strange Printer II</a></h2> <img src='https://img.shields.io/badge/Difficulty-Hard-red' alt='Difficulty: Hard' /><hr><p>There is a strange printer with the following two special requirements:</p>
2+
3+
<ul>
4+
<li>On each turn, the printer will print a solid rectangular pattern of a single color on the grid. This will cover up the existing colors in the rectangle.</li>
5+
<li>Once the printer has used a color for the above operation, <strong>the same color cannot be used again</strong>.</li>
6+
</ul>
7+
8+
<p>You are given a <code>m x n</code> matrix <code>targetGrid</code>, where <code>targetGrid[row][col]</code> is the color in the position <code>(row, col)</code> of the grid.</p>
9+
10+
<p>Return <code>true</code><em> if it is possible to print the matrix </em><code>targetGrid</code><em>,</em><em> otherwise, return </em><code>false</code>.</p>
11+
12+
<p>&nbsp;</p>
13+
<p><strong class="example">Example 1:</strong></p>
14+
<img alt="" src="https://assets.leetcode.com/uploads/2021/12/23/print1.jpg" style="width: 600px; height: 175px;" />
15+
<pre>
16+
<strong>Input:</strong> targetGrid = [[1,1,1,1],[1,2,2,1],[1,2,2,1],[1,1,1,1]]
17+
<strong>Output:</strong> true
18+
</pre>
19+
20+
<p><strong class="example">Example 2:</strong></p>
21+
<img alt="" src="https://assets.leetcode.com/uploads/2021/12/23/print2.jpg" style="width: 600px; height: 367px;" />
22+
<pre>
23+
<strong>Input:</strong> targetGrid = [[1,1,1,1],[1,1,3,3],[1,1,3,4],[5,5,1,4]]
24+
<strong>Output:</strong> true
25+
</pre>
26+
27+
<p><strong class="example">Example 3:</strong></p>
28+
29+
<pre>
30+
<strong>Input:</strong> targetGrid = [[1,2,1],[2,1,2],[1,2,1]]
31+
<strong>Output:</strong> false
32+
<strong>Explanation:</strong> It is impossible to form targetGrid because it is not allowed to print the same color in different turns.
33+
</pre>
34+
35+
<p>&nbsp;</p>
36+
<p><strong>Constraints:</strong></p>
37+
38+
<ul>
39+
<li><code>m == targetGrid.length</code></li>
40+
<li><code>n == targetGrid[i].length</code></li>
41+
<li><code>1 &lt;= m, n &lt;= 60</code></li>
42+
<li><code>1 &lt;= targetGrid[row][col] &lt;= 60</code></li>
43+
</ul>

0 commit comments

Comments
 (0)