OpenAI

Verified interview challenge

Simulate Conway's Game of Life

Simulate a grid of living and dead cells without letting one update change the rest of the same step.

Unlock with Full Access

The challenge

Read a binary grid and advance it through a fixed number of Conway's Game of Life steps. Every cell in a step must be calculated from the same previous state. Handle the edges of the finite grid and print the final result in the required console format.

What you'll practise

  • Synchronous updates

    Keep the previous grid separate from changes being computed for the next step.

  • Boundary handling

    Apply neighbour rules correctly at edges and corners while preserving the output format.

Your coding workspacePreview
solution.pyPython 3.13
import sys

def main():
    # Read input and print your result
    pass
Test cases

Run your code to see results.

Full instructions, starter code and test cases included with Full Access.