Ctrl K

Spreading Ink Blot

Medium
In the first minute a blot of ink lands on an infinite sheet of grid paper and colours one cell. Every following minute the ink spreads: every clean cell that shares a **side** with an inked cell gets inked too. Return how many cells are inked after minutes minutes.
Example 1
minutes=3 → 13

After the first minute there is 1 cell, the second adds its 4 neighbours, the third adds 8 more. That is 13 cells forming a diamond.

Example 2
minutes=1 → 1

Only the starting cell has been inked.

Example 3
minutes=6 → 61
Constraints
  • 1 ≤ minutes ≤ 10⁵
Have you seen this problem in a real interview?
Solved by0
Tried by0
Submissions0
Acceptance—
Topics
Similar problemsAdding Digit Lists MediumBackwards Digits in 32 Bits MediumNumber in Roman Numerals MediumDivision Without Dividing MediumMultiplying Digit Strings Medium
loading Python…
Input
minutes=3
Expected
13

Run checks the first 3 tests in your browser. Submit checks all 40 tests on the server, hidden ones included.