On an infinite grid of uncolored cells, at minute 1 you color any one cell. Every minute after that, every uncolored cell that touches a colored cell (sharing a side) is colored. Given n, return the number of colored cells at the end of minute n.
On an infinite grid of uncolored cells, at minute 1 you color any one cell. Every minute after that, every uncolored cell that touches a colored cell (sharing a side) is colored. Given n, return the number of colored cells at the end of minute n.
Example 1:
Input: {"n":1}
Output: 1
Constraints:
1≤n≤105
Test Cases
Input (Stdin)
Expected Output (Stdout)
Execution Result
Run code to see results.
Input
arr ={"n":1}
Minute 1: color a single cell. We need the count after minute 1.