Skip to content

Commit bb3645b

Browse files
committed
Create README - LeetHub
1 parent aef4fb1 commit bb3645b

File tree

1 file changed

+35
-0
lines changed
  • 2061-painting-a-grid-with-three-different-colors

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<h2><a href="https://leetcode.com/problems/painting-a-grid-with-three-different-colors">2061. Painting a Grid With Three Different Colors</a></h2><h3>Hard</h3><hr><p>You are given two integers <code>m</code> and <code>n</code>. Consider an <code>m x n</code> grid where each cell is initially white. You can paint each cell <strong>red</strong>, <strong>green</strong>, or <strong>blue</strong>. All cells <strong>must</strong> be painted.</p>
2+
3+
<p>Return<em> the number of ways to color the grid with <strong>no two adjacent cells having the same color</strong></em>. Since the answer can be very large, return it <strong>modulo</strong> <code>10<sup>9</sup> + 7</code>.</p>
4+
5+
<p>&nbsp;</p>
6+
<p><strong class="example">Example 1:</strong></p>
7+
<img alt="" src="https://assets.leetcode.com/uploads/2021/06/22/colorthegrid.png" style="width: 200px; height: 50px;" />
8+
<pre>
9+
<strong>Input:</strong> m = 1, n = 1
10+
<strong>Output:</strong> 3
11+
<strong>Explanation:</strong> The three possible colorings are shown in the image above.
12+
</pre>
13+
14+
<p><strong class="example">Example 2:</strong></p>
15+
<img alt="" src="https://assets.leetcode.com/uploads/2021/06/22/copy-of-colorthegrid.png" style="width: 321px; height: 121px;" />
16+
<pre>
17+
<strong>Input:</strong> m = 1, n = 2
18+
<strong>Output:</strong> 6
19+
<strong>Explanation:</strong> The six possible colorings are shown in the image above.
20+
</pre>
21+
22+
<p><strong class="example">Example 3:</strong></p>
23+
24+
<pre>
25+
<strong>Input:</strong> m = 5, n = 5
26+
<strong>Output:</strong> 580986
27+
</pre>
28+
29+
<p>&nbsp;</p>
30+
<p><strong>Constraints:</strong></p>
31+
32+
<ul>
33+
<li><code>1 &lt;= m &lt;= 5</code></li>
34+
<li><code>1 &lt;= n &lt;= 1000</code></li>
35+
</ul>

0 commit comments

Comments
 (0)