Reported October 2025
Temporalsimulation

Game of Life Next Generation

Reported by candidates from Temporal's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Temporal OA. Under 2s to a working solution.
Founder's read

The Temporal OA reported in October 2025 hands you Conway's Game of Life and asks for one generation. The whole problem hinges on one data structure choice: a second grid, or state encoded in the same one. If you update in place and read the new values as old ones, your answer is wrong. It's a simulation problem on a grid of up to 200 by 200, so nothing here is algorithmically scary. The risk is a silly bug under a clock. If you blank on the in-place trick, StealthCoder runs invisibly during the live OA and gives you a working solution to fall back on.

The problem

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]]
Apply all births and deaths simultaneously.
Example 2
board = [[1,1],[1,0]]
return = [[1,1],[1,1]]
The dead corner has three live neighbors and is born.
Example 3
board = [[1]]
return = [[0]]
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.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The trick is simultaneity. Every decision must use the original generation, so you can't flip cells as you scan. Easy route: copy the board, count the eight neighbors from the copy, write results into the original. That's O(m*n) time and O(m*n) space. Cleaner route: encode transitions in place. Use 2 for live to dead and 3 for dead to live. When counting neighbors, treat values 1 and 2 as originally live. Then a final pass maps 2 to 0 and 3 to 1. Pitfalls: bounds checks on edges, counting the cell itself as a neighbor, and applying the rules to the already-updated value. Check Example 2 by hand, since the dead corner with three live neighbors is born. StealthCoder is your hedge in the live OA if the in-place encoding slips your mind mid-assessment.

The honest play: practice the pattern, and have StealthCoder ready for the one you didn't see coming.

If this hits your live OA

You can drill Game of Life Next Generation cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play.

Get StealthCoder

Related leaked OAs

⏵ Practice the LeetCode equivalent

This OA pattern shows up on LeetCode as game of life. If you have time before the OA, drill that.

⏵ The honest play

You've seen the question. Make sure you actually pass Temporal's OA.

Temporal reuses patterns across OAs. Built for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Game of Life Next Generation FAQ

How hard is the Temporal Game of Life question really?+

Easy to medium. The rules are given in the prompt, so there's no hidden algorithm. The difficulty is correctness: simultaneous updates, edge bounds, and not double-counting the cell itself. If you can write a clean eight-direction neighbor loop, you're most of the way there.

What's the trick to avoid updating cells too early?+

Never read from a board you're mutating without a marker. Either copy the grid first and count from the copy, or encode transitions in place with extra values like 2 for live-to-dead and 3 for dead-to-live. Then finish with one cleanup pass.

Do I need the in-place solution or is a copy fine?+

The constraints cap the grid at 200 by 200, so a copy is tiny and fine. The prompt only asks you to return the updated grid. Write the copy version first so it's correct, and only optimize if you have spare time.

How do I handle the borders cleanly?+

Loop over the eight direction offsets and skip any neighbor outside 0 to rows-1 or 0 to cols-1. Don't pad or special-case corners. One bounds check inside the loop covers every edge, and Example 3 with a single cell tests it.

How do I prepare for this in 48 hours?+

Write the copy-based version from memory, then the in-place encoded one. Run all three examples by hand, especially the 2 by 2 grid. Also practice other grid simulation problems, since the neighbor-offset pattern shows up constantly.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Temporal.

OA at Temporal?
Invisible during screen share
Get it