Tap here to switch tabs
Problem
Submissions

Problem: Count Total Number of Colored Cells

Count Total Number of Colored Cells asks you to track an expanding infinite grid: one arbitrary cell is colored first, then edge-sharing uncolored cells spread each minute. Return the total after n minutes.

Statement

An infinite two dimensional grid of unit cells starts completely uncolored. You are given a positive integer n.

During the first minute, exactly 11 arbitrary cell is colored.

Every subsequent minute, every uncolored cell that shares an edge with at least 11 already colored cell also becomes colored.

Return the total count of colored cells after n minutes have passed.

Constraints:

  • 1≤1 \leq n ≤105\leq 10^5

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Count Total Number of Colored Cells

Count Total Number of Colored Cells asks you to track an expanding infinite grid: one arbitrary cell is colored first, then edge-sharing uncolored cells spread each minute. Return the total after n minutes.

Statement

An infinite two dimensional grid of unit cells starts completely uncolored. You are given a positive integer n.

During the first minute, exactly 11 arbitrary cell is colored.

Every subsequent minute, every uncolored cell that shares an edge with at least 11 already colored cell also becomes colored.

Return the total count of colored cells after n minutes have passed.

Constraints:

  • 1≤1 \leq n ≤105\leq 10^5