Count how many cells are colored after expanding a symmetric diamond-like pattern for steps.
You start with 1 colored cell in the first step. In each next step, the colored shape grows symmetrically by adding a new outer layer around the previous shape. For step , determine the total number of colored cells after the growth has been applied times.
The growth follows the standard pattern where the number of newly added cells increases by 4 every two steps, producing a centered diamond-like expansion.
n representing the number of growth steps.n steps.Example 1
Input
n = 1
Output
1
Explanation
The first step colors only the center cell.
Example 2
Input
n = 2
Output
5
Explanation
The second step adds 4 surrounding cells, for a total of 1 + 4 = 5.
Example 3
Input
n = 3
Output
13
Explanation
The growth adds 8 more cells on the third step, giving 1 + 4 + 8 = 13.
Premium problem context
Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.