You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# [2579.Count Total Number of Colored Cells][title]
2
+
3
+
## Description
4
+
There exists an infinitely large two-dimensional grid of uncolored unit cells. You are given a positive integer `n`, indicating that you must do the following routine for `n` minutes:
5
+
6
+
- At the first minute, color **any** arbitrary unit cell blue.
7
+
- Every minute thereafter, color blue **every** uncolored cell that touches a blue cell.
8
+
9
+
Below is a pictorial representation of the state of the grid after minutes 1, 2, and 3.
10
+
11
+
12
+

13
+
14
+
Return the number of colored cells at the end of n minutes.
15
+
16
+
**Example 1:**
17
+
18
+
```
19
+
Input: n = 1
20
+
Output: 1
21
+
Explanation: After 1 minute, there is only 1 blue cell, so we return 1.
22
+
```
23
+
24
+
**Example 2:**
25
+
26
+
```
27
+
Input: n = 2
28
+
Output: 5
29
+
Explanation: After 2 minutes, there are 4 colored cells on the boundary and 1 in the center, so we return 5.
0 commit comments