FastPrepGame of Life Next Generation
Problems/Game of Life Next Generation

Game of Life Next Generation

Temporal logoTemporal● MediumFULLTIMEONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A firsthand Temporal onsite report dated October 19, 2025 clearly describes the well-known Game of Life as the coding exercise. Our version is about 92% the same as the reported question.

Given a finite binary grid, compute one simultaneous generation of Conway's Game of Life. Every cell has up to eight neighbors.

  • A live cell survives with two or three live neighbors.
  • A dead cell becomes live with exactly three live neighbors.
  • Every other cell is dead in the next generation.

Return the updated grid. All decisions must use the original generation.

Function

gameOfLife(board: int[][]) → int[][]

Examples

Example 1

board = [[0,1,0],[0,0,1],[1,1,1],[0,0,0]]return = [[0,0,0],[1,0,1],[0,1,1],[0,1,0]]
board
0120010100121113000
→
return
0120000110120113010
Moved or new

Apply all births and deaths simultaneously.

Example 2

board = [[1,1],[1,0]]return = [[1,1],[1,1]]
board
01011110
→
return
01011111
Moved or new

The dead corner has three live neighbors and is born.

Example 3

board = [[1]]return = [[0]]
board
001
→
return
000
Moved or new

The isolated cell dies from underpopulation.

Constraints

  • 1 <= board.length, board[i].length <= 200.
  • Every cell is 0 or 1, and the grid is rectangular.

More Temporal interview questions

  • Concurrent Volley ShotPHONE SCREEN · Seen Apr 2026
  • Normalize and Aggregate Error LogsPHONE SCREEN · Seen Feb 2026
  • Concurrent Web Crawler ReachabilityPHONE SCREEN · Seen Oct 2025
  • Delayed Task Executor OrderingPHONE SCREEN · Seen May 2025

Similar questions at other companies

  • Spiral MatrixNike, Inc. · ONSITE INTERVIEWNike, Inc. interview questions
  • Incremental Hard Attention with a KV CacheOpenAI · PHONE SCREEN · ONSITE INTERVIEWOpenAI interview questions
  • Stochastic Gradient Descent with MomentumMeta · ONSITE INTERVIEWMeta interview questions
  • Minesweeper Board UpdateUber · ONSITE INTERVIEWUber interview questions
  • Game of Life: In-Place Next GenerationGoogle · ONSITE INTERVIEWGoogle interview questions
  • Diagonal Matrix IteratorMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
  • Candy Crush Board Until StableBloomberg LP · ONSITE INTERVIEWBloomberg LP interview questions
  • Minesweeper Board UpdateClay · ONSITE INTERVIEW
  • Minesweeper Board UpdateAirbyte · ONSITE INTERVIEW
  • Clockwise Spiral Walk of a GridExpedia · ONSITE INTERVIEWExpedia interview questions
All Temporal interview questionsSee Temporal hiring insights
Saved
class Solution {
    public int[][] gameOfLife(int[][] board) {
        // write your code here
    }
}
Checking account…