Premium problem88. Game of Life Step

Hard Locked

Implement Conway's Game of Life on the 0/1 array Z and return the board after steps iterations:

  • standard 8-neighbour birth/survival rules
  • cells on the outer border stay 0

Input

Z =
[[0 0 0 0 0]
 [0 0 0 0 0]
 [0 1 1 1 0]
 [0 0 0 0 0]
 [0 0 0 0 0]]
steps = 1

Output

[[0 0 0 0 0]
 [0 0 1 0 0]
 [0 0 1 0 0]
 [0 0 1 0 0]
 [0 0 0 0 0]]

Premium problem

This one's part of Premium. Unlock the full NumPy track plus every other premium problem on the site.

Implement solve(...)